Uh oh!
There was an error while loading. Please reload this page.
ARROW-16685: [Python] Failing docstring example in Table.join - #13260
ARROW-16685: [Python] Failing docstring example in Table.join#13260AlenkaF wants to merge 3 commits into
Conversation
AlenkaF
commented
May 30, 2022
@amol- do you mind reviewing this fix? |
amol-
commented
May 30, 2022
Would it make sense to add the select for the other kind of joins too? In theory all of them have unpredictable order |
raulcd
commented
May 30, 2022
The current doctest failures seem to be broken since this commit was merged on master: adb5b00 Is this an expected change or a bug being introduced? @westonpace@sanjibansg ? |
amol-
commented
May 30, 2022
Might it be that it just needs a rebase to master? It seems there were recent fixes to that example -> 9a7cc52 |
raulcd
commented
May 30, 2022
Maybe but I don't think so, the last commit on master (f3af2b7) triggered a build for that specific build sphinx and doctest job (https://github.com/apache/arrow/runs/6654897048?check_suite_focus=true#step:6:5459) and is also failing with the same error: |
It maybe because of the changed definition of the |
raulcd
commented
May 30, 2022
Applying this diff fixes it locally: @sanjibansg can you confirm that adding the |
Is this going to impact users? Are they going to face any change in behaviour when upgrading to 9.0.0 or it's just an internal change given that users usually don't invoke |
pitrou
commented
May 30, 2022
For the record, I understand that rows are in an unpredictable order after a join, but why are the columns in an unpredictable order? |
amol-
commented
May 30, 2022
Haven't checked the details of our HasJoinNode implementation, but usually hash joins start picking the biggest of the two tables and joining the smaller to it. So the order of columns usually depends on which tables is picked first. |
pitrou
commented
May 30, 2022
Right, but the examples should be deterministic in any case. Also, the implementation could trivially reorder the output columns so that they are always in the same order regardless of table size. @westonpace Am I wrong? |
sanjibansg
commented
May 31, 2022
Yes, I think it should work now, we need that |
jorisvandenbossche
commented
May 31, 2022
I opened #13269 for the |
Uh oh!
There was an error while loading. Please reload this page.
I was wondering exactly the same, I don't see a reason why not preserving the column order of the input DataFrames. Some observations from trying to reproduce it locally (which strangely first didn't work in an interactive session):
|
jorisvandenbossche
commented
May 31, 2022
Actually, that made we wonder if this isn't some issue with an unordered set either in Python or C++, and indeed for the inner join we are using Python's set, which I suppose might cause this undeterministic behaviour? arrow/python/pyarrow/_exec_plan.pyx Lines 260 to 262 in 4847b85 |
pitrou
commented
May 31, 2022
Right, so it's a bug that needs fixing rather than something to workaround in the doc examples. |
AlenkaF
commented
May 31, 2022
Agree. Will close this PR and change the title of the JIRA issue. |
For future reference, the column output order of the hash join should be deterministic. There may be cases where we switch the sides or join things in a different order for performance reasons. Howver, if the execution engine does this it should always restore the order before sending any batches to a sink. |
Added a step in the example where the columns are selected. This way the order of the columns is fixed and the doctest should pass.