From 19a46944b7d44e9efff0c5524a4e1546590db500 Mon Sep 17 00:00:00 2001 From: vdimir Date: Wed, 6 Nov 2024 10:46:35 +0000 Subject: [PATCH] fix --- src/Planner/PlannerJoinTree.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Planner/PlannerJoinTree.cpp b/src/Planner/PlannerJoinTree.cpp index 60d5ca8a8ff..c6478e14be8 100644 --- a/src/Planner/PlannerJoinTree.cpp +++ b/src/Planner/PlannerJoinTree.cpp @@ -1354,13 +1354,13 @@ JoinTreeQueryPlan buildQueryPlanForJoinNode(const QueryTreeNodePtr & join_table_ && (right_pre_filters.empty() || FilterStep::canUseType(right_pre_filters[0]->result_type)) && (left_pre_filters.empty() || FilterStep::canUseType(left_pre_filters[0]->result_type)); - auto add_pre_filter = [&](ActionsDAG & join_expressions_actions, QueryPlan & plan, const auto & pre_filters) + auto add_pre_filter = [can_move_out_residuals](ActionsDAG & join_expressions_actions, QueryPlan & plan, UsefulSets & useful_sets, const auto & pre_filters) { - join_expressions_actions.appendInputsForUnusedColumns(left_plan.getCurrentHeader()); - appendSetsFromActionsDAG(join_expressions_actions, left_join_tree_query_plan.useful_sets); + join_expressions_actions.appendInputsForUnusedColumns(plan.getCurrentHeader()); + appendSetsFromActionsDAG(join_expressions_actions, useful_sets); QueryPlanStepPtr join_expressions_actions_step; - if (can_move_out_residuals && !left_pre_filters.empty()) + if (can_move_out_residuals && !pre_filters.empty()) join_expressions_actions_step = std::make_unique(plan.getCurrentHeader(), std::move(join_expressions_actions), pre_filters[0]->result_name, false); else join_expressions_actions_step = std::make_unique(plan.getCurrentHeader(), std::move(join_expressions_actions)); @@ -1368,8 +1368,8 @@ JoinTreeQueryPlan buildQueryPlanForJoinNode(const QueryTreeNodePtr & join_table_ join_expressions_actions_step->setStepDescription("JOIN actions"); plan.addStep(std::move(join_expressions_actions_step)); }; - add_pre_filter(join_clauses_and_actions.left_join_expressions_actions, left_plan, left_pre_filters); - add_pre_filter(join_clauses_and_actions.right_join_expressions_actions, right_plan, right_pre_filters); + add_pre_filter(join_clauses_and_actions.left_join_expressions_actions, left_plan, left_join_tree_query_plan.useful_sets, left_pre_filters); + add_pre_filter(join_clauses_and_actions.right_join_expressions_actions, right_plan, right_join_tree_query_plan.useful_sets, right_pre_filters); } std::unordered_map left_plan_column_name_to_cast_type;