@@ -1635,6 +1635,29 @@ def test_merge_left_on_right_on(scalars_dfs, merge_how):
16351635 )
16361636
16371637
1638+ def test_self_merge_self_w_on_args ():
1639+ data = {
1640+ "A" : pd .Series ([1 , 2 , 3 ], dtype = "Int64" ),
1641+ "B" : pd .Series ([1 , 2 , 3 ], dtype = "Int64" ),
1642+ "C" : pd .Series ([100 , 200 , 300 ], dtype = "Int64" ),
1643+ "D" : pd .Series (["alpha" , "beta" , "gamma" ], dtype = "string[pyarrow]" ),
1644+ }
1645+ df = pd .DataFrame (data )
1646+
1647+ df1 = df [["A" , "C" ]]
1648+ df2 = df [["B" , "C" , "D" ]]
1649+ pd_result = df1 .merge (df2 , left_on = ["A" , "C" ], right_on = ["B" , "C" ], how = "inner" )
1650+
1651+ bf_df = bpd .DataFrame (data )
1652+
1653+ bf_df1 = bf_df [["A" , "C" ]]
1654+ bf_df2 = bf_df [["B" , "C" , "D" ]]
1655+ bf_result = bf_df1 .merge (
1656+ bf_df2 , left_on = ["A" , "C" ], right_on = ["B" , "C" ], how = "inner"
1657+ ).to_pandas ()
1658+ pd .testing .assert_frame_equal (bf_result , pd_result , check_index_type = False )
1659+
1660+
16381661@pytest .mark .parametrize (
16391662 ("decimals" ,),
16401663 [
0 commit comments