Repository navigation
Non-experimental non-equi join conditions - #69910
Conversation
|
This is an automated comment for commit ebe76f9 with description of existing statuses. It's updated for the latest CI running ✅ Click here to open a full report in a separate page Successful checks
|
a9f3383 to
6434da7
Compare
|
@novikd could you please take a look? |
| const auto & left_pre_filters = join_clauses_and_actions.join_clauses[0].getLeftFilterConditionNodes(); | ||
| if (!left_pre_filters.empty() && left_pre_filters.size() != 1) | ||
| throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected only one left pre-filter condition node. Actual [{}]", fmt::join(left_pre_filters | std::views::transform([](const auto & node) { return node->result_name; }), ", ")); |
There was a problem hiding this comment.
It can be extracted to a separate function to reduce copy-paste.
| join_clauses_and_actions.right_join_expressions_actions.appendInputsForUnusedColumns(right_plan.getCurrentDataStream().header); | ||
| auto right_join_expressions_actions_step = std::make_unique<ExpressionStep>(right_plan.getCurrentDataStream(), std::move(join_clauses_and_actions.right_join_expressions_actions)); | ||
| appendSetsFromActionsDAG(join_clauses_and_actions.right_join_expressions_actions, right_join_tree_query_plan.useful_sets); | ||
|
|
||
| QueryPlanStepPtr right_join_expressions_actions_step; | ||
| if (can_move_out_residuals && !right_pre_filters.empty()) | ||
| right_join_expressions_actions_step = std::make_unique<FilterStep>(right_plan.getCurrentDataStream(), std::move(join_clauses_and_actions.right_join_expressions_actions), right_pre_filters[0]->result_name, false); | ||
| else | ||
| right_join_expressions_actions_step = std::make_unique<ExpressionStep>(right_plan.getCurrentDataStream(), std::move(join_clauses_and_actions.right_join_expressions_actions)); | ||
| right_join_expressions_actions_step->setStepDescription("JOIN actions"); |
There was a problem hiding this comment.
Looks like it can be extracted to a function too
There was a problem hiding this comment.
ClickHouse/src/Planner/PlannerJoinTree.cpp
Lines 1305 to 1319 in d17d4c6
There was a problem hiding this comment.
Tried to do it with helper function forJoinSides (it's quite common pattern to call some function in such way in joins), but seems it's a bit complicated, just extracted lambda and removed forJoinSides
| result_plan.unitePlans(std::move(join_step), {std::move(plans)}); | ||
| } | ||
|
|
||
| if (join_clauses_and_actions.mixed_join_expressions_actions) |
There was a problem hiding this comment.
If we haven't moved expression into join, we can just add this expression as a filter after join, I've added a comment
| } | ||
|
|
||
| JoinTreeQueryPlan buildQueryPlanForJoinNode(const QueryTreeNodePtr & join_table_expression, | ||
| const QueryTreeNodePtr & nearest_query_node, |
There was a problem hiding this comment.
Do you actually need this parameter?
There was a problem hiding this comment.
Indeed, initially I wanted not only to move expression from ON to WHERE here but in the opposite direction as well, so I needed to have corresponding query scope to access to WHERE query tree. However, let's avoid implementing in in that PR, maybe revisit after JoinStep refactoring, so here only focus on removal of allow_experimental_join_condition, so I've reverted that part of changes
27664d0 to
d17d4c6
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
allow_experimental_join_conditionsetting, allowing non-equi conditions by defaultClose #46254
Documentation entry for user-facing changes
CI Settings (Only check the boxes if you know what you are doing):