Fix incorrect RIGHT join result when using complex ON conditions#94680
Fix incorrect RIGHT join result when using complex ON conditions#94680
Conversation
|
Workflow [PR], commit [dbf74c9] Summary: ❌
|
e35f5a3 to
dbf74c9
Compare
| SELECT | ||
| * | ||
| FROM t1 | ||
| RIGHT JOIN t0 |
There was a problem hiding this comment.
Let's add queries with LEFT JOIN from the issue as well.
There was a problem hiding this comment.
Thanks for the suggestion! I took a look, and queries using LEFT JOIN return the correct results (unless they’re rewritten to RIGHT JOIN depending on query_plan_join_swap_table, what happened in query from the issue). Since this PR is specifically fixing the RIGHT JOIN behavior, adding LEFT JOIN cases wouldn’t actually cover any of the code paths changed here.
If you still think adding LEFT JOIN cases would be useful for completeness, I’m happy to do that in a follow-up PR. That way we can merge this fix without waiting on another CI run, which might be helpful given the upcoming release.
| per_row_flags[columns] = std::vector<std::atomic_bool>(columns->at(0)->size()); | ||
|
|
||
| /// Mark all rows outside of selector as used. | ||
| /// We should not emit them in RIGHT/FULL JOIN result, | ||
| /// since they belongs to another shard, which will handle flags for these rows | ||
| for (auto & flag : per_row_flags[columns]) | ||
| flag.store(true); |
There was a problem hiding this comment.
| per_row_flags[columns] = std::vector<std::atomic_bool>(columns->at(0)->size()); | |
| /// Mark all rows outside of selector as used. | |
| /// We should not emit them in RIGHT/FULL JOIN result, | |
| /// since they belongs to another shard, which will handle flags for these rows | |
| for (auto & flag : per_row_flags[columns]) | |
| flag.store(true); | |
| /// Mark all rows outside of selector as used. | |
| /// We should not emit them in RIGHT/FULL JOIN result, | |
| /// since they belongs to another shard, which will handle flags for these rows | |
| per_row_flags[columns] = std::vector<std::atomic_bool>(columns->at(0)->size(), true); |
Cherry pick #94680 to 25.10: Fix incorrect RIGHT join result when using complex ON conditions
…complex ON conditions
Cherry pick #94680 to 25.11: Fix incorrect RIGHT join result when using complex ON conditions
…complex ON conditions
Cherry pick #94680 to 25.12: Fix incorrect RIGHT join result when using complex ON conditions
…complex ON conditions
Cherry pick #94680 to 25.3: Fix incorrect RIGHT join result when using complex ON conditions
…omplex ON conditions
Cherry pick #94680 to 25.8: Fix incorrect RIGHT join result when using complex ON conditions
…omplex ON conditions
Backport #94680 to 25.12: Fix incorrect RIGHT join result when using complex ON conditions
Backport #94680 to 25.10: Fix incorrect RIGHT join result when using complex ON conditions
Backport #94680 to 25.11: Fix incorrect RIGHT join result when using complex ON conditions
Backport #94680 to 25.8: Fix incorrect RIGHT join result when using complex ON conditions
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
query_plan_filter_push_downvalue #92913