code: def test_merge_one_chunk(setup):
      def sort_by_col1(df):
          return df.sort_values(by=df.columns[1], kind="mergesort")
  
      df1 = pd.DataFrame(
          {"lkey": ["foo", "bar", "baz", "foo"], "value": [1, 2, 3, 5]},
          index=["a1", "a2", "a3", "a4"],
      )
      df2 = pd.DataFrame(
          {"rkey": ["foo", "bar", "baz", "foo"], "value": [5, 6, 7, 8]},
          index=["a1", "a2", "a3", "a4"],
      )
  
      # all have one chunk
      mdf1 = from_pandas(df1)
      mdf2 = from_pandas(df2)
  
      expected = df1.merge(df2, left_on="lkey", right_on="rkey")
      jdf = mdf1.merge(
          mdf2, left_on="lkey", right_on="rkey", auto_merge="none"
      )
      result = jdf.execute().fetch()
  
      pd.testing.assert_frame_equal(
          expected.sort_values(by=expected.columns[1]).reset_index(
              drop=True
          ),
          result.sort_values(by=result.columns[1]).reset_index(
              drop=True
          ),
      )
  
      # left have one chunk
      mdf1 = from_pandas(df1)
      mdf2 = from_pandas(df2, chunk_size=2)
  
      expected = df1.merge(df2, left_on="lkey", right_on="rkey")
      jdf = mdf1.merge(
          mdf2, left_on="lkey", right_on="rkey", auto_merge="none"
      )
      result = jdf.execute().fetch()
  
      pd.testing.assert_frame_equal(
          sort_by_col1(expected).reset_index(drop=True),
          sort_by_col1(result).reset_index(drop=True),
      )
  
      # right have one chunk
      mdf1 = from_pandas(df1, chunk_size=3)
      mdf2 = from_pandas(df2)
  
      expected = df1.merge(df2, left_on="lkey", right_on="rkey")
      jdf = mdf1.merge(
          mdf2, left_on="lkey", right_on="rkey", auto_merge="none"
      )
      result = jdf.execute().fetch()
  
      pd.testing.assert_frame_equal(
          sort_by_col1(expected).reset_index(drop=True),
          sort_by_col1(result).reset_index(drop=True),
      )
  
      # left have one chunk and how="left", then one chunk tile
      # will result in wrong results, see #GH 2107
      mdf1 = from_pandas(df1, chunk_size=2)
      mdf2 = from_pandas(df2)
  
      expected = df2.merge(
          df1, left_on="rkey", right_on="lkey", how="left"
      )
      jdf = mdf2.merge(
          mdf1,
          left_on="rkey",
          right_on="lkey",
          how="left",
          auto_merge="none",
      )
      result = jdf.execute().fetch()
  
      pd.testing.assert_frame_equal(
          sort_by_col1(expected).reset_index(drop=True),
          sort_by_col1(result).reset_index(drop=True),
      )
  
file_path: mars/mars/dataframe/merge/tests/test_merge_execution.py
imports: import numpy
  import pandas
  import pytest
  from ....core.graph.builder.utils import build_graph
  from ...datasource.dataframe import from_pandas
  from ...datasource.series import from_pandas
  from ...utils import sort_dataframe_inplace
  from ..None import concat, DataFrameConcat, DataFrameMergeAlign
label_desc: Use image node_id 4 for calling a global function with example usage: test_merge_one_chunk(setup) and returns: df