rows of non key column are reversed after left join of two table
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the bug, including details regarding any error messages, version, and platform.
Here table left and right joins by Idx column, "Series" column in right table has its original sequence **always reversed** in output table. How to preserve original ordering ? This happens in both c++ and python code. Example shown below
def test_hash_join_order():
# Test with different Series orders in right table
left = pa.table({'City': ["NEWYORK"], 'Number': [44], 'Idx':[1]})
# Test case 1: Original order [0,1,2,3]
right1 = pa.table({'Idx': [1, 1, 1, 1], 'Series': [0,1,2,3]})
# Test case 2: Reverse order [3,2,1,0]
right2 = pa.table({'Idx': [1, 1, 1, 1], 'Series': [3,2,1,0]})
# Test case 3: Random order [2,0,3,1]
right3 = pa.table({'Idx': [1, 1, 1, 1], 'Series': [2,0,3,1]})
def do_join(right):
left_source = Declaration("table_source", options=TableSourceNodeOptions(left))
right_source = Declaration("table_source", options=TableSourceNodeOptions(right))
join_opts = HashJoinNodeOptions("left outer", left_keys="Idx", right_keys="Idx")
joined = Declaration("hashjoin", options=join_opts, inputs=[left_source, right_source])
return joined.to_table()
print("Test 1 (Original order):", do_join(right1).column('Series').to_pylist())
print("Test 2 (Reverse order):", do_join(right2).column('Series').to_pylist())
print("Test 3 (Random order):", do_join(right3).column('Series').to_pylist())
test_hash_join_order()
Output:
Test 1 (Original order): [3, 2, 1, 0]
Test 2 (Reverse order): [0, 1, 2, 3]
Test 3 (Random order): [1, 3, 0, 2]
### Component(s)
C++
Contributor guide
Assessment
This issue has not been assessed yet.