code: def test_joins(
      jointype, expected, use_threads, coalesce_keys, use_datasets
  ):
      # Allocate table here instead of using parametrize
      # this prevents having arrow allocated memory forever around.
      expected = pa.table(expected)
  
      t1 = pa.Table.from_pydict(
          {"colA": [1, 2, 6], "col2": ["a", "b", "f"]}
      )
  
      t2 = pa.Table.from_pydict(
          {"colB": [99, 2, 1], "col3": ["Z", "B", "A"]}
      )
  
      if use_datasets:
          t1 = ds.dataset([t1])
          t2 = ds.dataset([t2])
  
      r = _perform_join(
          jointype,
          t1,
          "colA",
          t2,
          "colB",
          use_threads=use_threads,
          coalesce_keys=coalesce_keys,
      )
      r = r.combine_chunks()
      if "right" in jointype:
          r = r.sort_by("colB")
      else:
          r = r.sort_by("colA")
      if coalesce_keys:
          if jointype in ("inner", "left outer"):
              expected = expected.drop(["colB"])
          elif jointype == "right outer":
              expected = expected.drop(["colA"])
          elif jointype == "full outer":
              expected = expected.drop(["colB"]).set_column(
                  0, "colA", [[1, 2, 6, 99]]
              )
      assert r == expected
  
file_path: arrow/python/pyarrow/tests/test_exec_plan.py
imports: import pytest
  import pyarrow
  import pyarrow.compute
  from .test_extension_type import IntegerType
label_desc: Use image node_id 2 for calling a global function with example usage: test_joins(jointype, expected, use_threads, coalesce_keys, use_datasets) without return types