code: def test_df_merge_on_index():
      left: DataFrame = DataFrame(
          {"foo": (1, 2, 3), "bar": (4, 5, 6), 1: (7, 8, 9)}
      )
      left = left.set_index("foo")
      right = DataFrame(
          {"foo": (1, 2), "bar": (4, 5), "baz": (5, 8), 1: (7, 8)}
      )
      right = right.set_index("foo")
  
      # join on index
      joined = left.merge(right, on="foo")
      input_columns = InputColumnSelector.select(joined.data, {"baz"})
      assert left.data in input_columns
      assert input_columns[left.data] == set()
      assert right.data in input_columns
      assert input_columns[right.data] == {"baz"}
  
      # left_on is an index and right_on is a column
      joined = left.merge(right, left_on="foo", right_on="bar")
      input_columns = InputColumnSelector.select(joined.data, {"baz"})
      assert left.data in input_columns
      assert input_columns[left.data] == set()
      assert right.data in input_columns
      assert input_columns[right.data] == {"bar", "baz"}
  
      # left_on is a column and right_on is an index
      joined = left.merge(right, left_on="bar", right_on="foo")
      input_columns = InputColumnSelector.select(joined.data, {"baz"})
      assert left.data in input_columns
      assert input_columns[left.data] == {"bar"}
      assert right.data in input_columns
      assert input_columns[right.data] == {"baz"}
  
imports: from typing import Dict, Any, Set, List, Union
  import pytest
  from ..input_column_selector import InputColumnSelector
  from ......core import TileableData, ENTITY_TYPE
  from ......core.operand import Operand
  from ......dataframe import DataFrame, Series
  from ......tensor import tensor
label_desc: Use image node_id 5 for calling a global function with example usage: test_df_merge_on_index() without return types