From 3330ad8c2bb1d54fa9e8c3170da89dc91e23f471 Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Tue, 31 Dec 2024 13:20:05 +0800 Subject: [PATCH] Fix Build Due to https://github.com/ClickHouse/ClickHouse/pull/73693 --- cpp-ch/local-engine/Operator/BranchStep.cpp | 17 +++++++++-------- cpp-ch/local-engine/Operator/BranchStep.h | 6 ++++-- .../Parser/RelParsers/GroupLimitRelParser.cpp | 2 +- .../Parser/RelParsers/JoinRelParser.cpp | 4 ++-- .../Parser/SerializedPlanParser.cpp | 4 ++-- .../scalar_function_parser/arrayExcept.cpp | 2 +- .../scalar_function_parser/arrayRemove.cpp | 2 +- .../scalar_function_parser/arrayRepeat.cpp | 2 +- .../scalar_function_parser/lambdaFunction.cpp | 2 +- .../Storages/Cache/CacheManager.cpp | 4 +++- cpp-ch/local-engine/tests/gtest_ch_join.cpp | 7 ++++--- 11 files changed, 29 insertions(+), 23 deletions(-) diff --git a/cpp-ch/local-engine/Operator/BranchStep.cpp b/cpp-ch/local-engine/Operator/BranchStep.cpp index 5e379ae9d4dc..c52b14420cb1 100644 --- a/cpp-ch/local-engine/Operator/BranchStep.cpp +++ b/cpp-ch/local-engine/Operator/BranchStep.cpp @@ -137,7 +137,7 @@ class ResizeStep : public DB::ITransformingStep private: size_t num_streams; - void updateOutputHeader() override {}; + void updateOutputHeader() override { }; }; DB::QueryPlanPtr BranchStepHelper::createSubPlan(const DB::Block & header, size_t num_streams) @@ -156,7 +156,7 @@ DB::QueryPlanPtr BranchStepHelper::createSubPlan(const DB::Block & header, size_ } StaticBranchStep::StaticBranchStep( - DB::ContextPtr context_, const DB::Block & header_, size_t branches_, size_t sample_rows_, BranchSelector selector_) + const DB::ContextPtr & context_, const DB::Block & header_, size_t branches_, size_t sample_rows_, BranchSelector selector_) : DB::ITransformingStep(header_, header_, getTraits()) , context(context_) , header(header_) @@ -168,7 +168,7 @@ StaticBranchStep::StaticBranchStep( void StaticBranchStep::transformPipeline(DB::QueryPipelineBuilder & pipeline, const DB::BuildQueryPipelineSettings & settings) { - auto build_transform = [&](DB::OutputPortRawPtrs child_outputs) -> DB::Processors + auto build_transform = [&](const DB::OutputPortRawPtrs & child_outputs) -> DB::Processors { DB::Processors new_processors; for (auto & output : child_outputs) @@ -195,8 +195,9 @@ void StaticBranchStep::updateOutputHeader() { } -UniteBranchesStep::UniteBranchesStep(const DB::Block & header_, std::vector && branch_plans_, size_t num_streams_) - : DB::ITransformingStep(header_, branch_plans_[0]->getCurrentHeader(), getTraits()), header(header_) +UniteBranchesStep::UniteBranchesStep( + const DB::ContextPtr & context_, const DB::Block & header_, std::vector && branch_plans_, size_t num_streams_) + : DB::ITransformingStep(header_, branch_plans_[0]->getCurrentHeader(), getTraits()), context(context_), header(header_) { branch_plans.swap(branch_plans_); size_t branches = branch_plans.size(); @@ -217,11 +218,11 @@ void UniteBranchesStep::transformPipeline(DB::QueryPipelineBuilder & pipeline, c child_outputs.size(), branch_plans.size()); } - for (auto output : child_outputs) + for (auto * output : child_outputs) { auto & branch_plan = branch_plans[branch_index]; - DB::QueryPlanOptimizationSettings optimization_settings; - DB::BuildQueryPipelineSettings build_settings; + DB::QueryPlanOptimizationSettings optimization_settings{context}; + DB::BuildQueryPipelineSettings build_settings{context}; DB::QueryPlanResourceHolder resource_holder; auto pipeline_builder = branch_plan->buildQueryPipeline(optimization_settings, build_settings); diff --git a/cpp-ch/local-engine/Operator/BranchStep.h b/cpp-ch/local-engine/Operator/BranchStep.h index fd2203aae80a..ef3d69e5c65e 100644 --- a/cpp-ch/local-engine/Operator/BranchStep.h +++ b/cpp-ch/local-engine/Operator/BranchStep.h @@ -42,7 +42,7 @@ class StaticBranchStep : public DB::ITransformingStep public: using BranchSelector = std::function &)>; explicit StaticBranchStep( - DB::ContextPtr context_, const DB::Block & header, size_t branches, size_t sample_rows, BranchSelector selector); + const DB::ContextPtr & context_, const DB::Block & header, size_t branches, size_t sample_rows, BranchSelector selector); ~StaticBranchStep() override = default; String getName() const override { return "StaticBranchStep"; } @@ -67,7 +67,8 @@ class StaticBranchStep : public DB::ITransformingStep class UniteBranchesStep : public DB::ITransformingStep { public: - explicit UniteBranchesStep(const DB::Block & header_, std::vector && branch_plans_, size_t num_streams_); + explicit UniteBranchesStep( + const DB::ContextPtr & context_, const DB::Block & header_, std::vector && branch_plans_, size_t num_streams_); ~UniteBranchesStep() override = default; String getName() const override { return "UniteBranchesStep"; } @@ -76,6 +77,7 @@ class UniteBranchesStep : public DB::ITransformingStep void describePipeline(DB::IQueryPlanStep::FormatSettings & settings) const override; private: + DB::ContextPtr context; DB::Block header; std::vector branch_plans; size_t num_streams; diff --git a/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp index 830634682756..b43c8064b3e1 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp @@ -245,7 +245,7 @@ DB::QueryPlanPtr AggregateGroupLimitRelParser::parse( std::vector branch_plans; branch_plans.emplace_back(std::move(aggregation_plan)); branch_plans.emplace_back(std::move(window_plan)); - auto unite_branches_step = std::make_unique(branch_in_header, std::move(branch_plans), 1); + auto unite_branches_step = std::make_unique(getContext(), branch_in_header, std::move(branch_plans), 1); unite_branches_step->setStepDescription("Unite TopK branches"); steps.push_back(unite_branches_step.get()); diff --git a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp index 7c5aeb23b9a7..3db111b6d46f 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp @@ -599,8 +599,8 @@ bool JoinRelParser::applyJoinFilter( return false; auto mixed_join_expressions_actions = expressionsToActionsDAG({expr}, mixed_header); mixed_join_expressions_actions.removeUnusedActions(); - table_join.getMixedJoinExpression() = std::make_shared( - std::move(mixed_join_expressions_actions), ExpressionActionsSettings::fromContext(context)); + table_join.getMixedJoinExpression() + = std::make_shared(std::move(mixed_join_expressions_actions), ExpressionActionsSettings(context)); } else { diff --git a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp index f3a9c3c90189..4ccdaea797c9 100644 --- a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp +++ b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp @@ -303,8 +303,8 @@ DB::QueryPipelineBuilderPtr SerializedPlanParser::buildQueryPipeline(DB::QueryPl IAST::QueryKind::Select, settings, 0); - const QueryPlanOptimizationSettings optimization_settings{.optimize_plan = settings[Setting::query_plan_enable_optimizations]}; - BuildQueryPipelineSettings build_settings = BuildQueryPipelineSettings::fromContext(context); + const QueryPlanOptimizationSettings optimization_settings{context}; + BuildQueryPipelineSettings build_settings = BuildQueryPipelineSettings{context}; build_settings.process_list_element = query_status; build_settings.progress_callback = nullptr; return query_plan.buildQueryPipeline(optimization_settings, build_settings); diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayExcept.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayExcept.cpp index 18b4f69aa435..e041985947a0 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayExcept.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayExcept.cpp @@ -74,7 +74,7 @@ class FunctionParserArrayExcept : public FunctionParser NamesAndTypesList lambda_arguments_names_and_types; lambda_arguments_names_and_types.emplace_back(x_in_lambda->result_name, x_in_lambda->result_type); DB::Names required_column_names = lambda_actions_dag.getRequiredColumnsNames(); - auto expression_actions_settings = DB::ExpressionActionsSettings::fromContext(getContext(), DB::CompileExpressions::yes); + auto expression_actions_settings = DB::ExpressionActionsSettings{getContext(), DB::CompileExpressions::yes}; auto function_capture = std::make_shared( std::move(lambda_actions_dag), expression_actions_settings, diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRemove.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRemove.cpp index 430c3d162764..fdd76b271d49 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRemove.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRemove.cpp @@ -71,7 +71,7 @@ class FunctionParserArrayRemove : public FunctionParser NamesAndTypesList lambda_arguments_names_and_types; lambda_arguments_names_and_types.emplace_back(x_in_lambda->result_name, x_in_lambda->result_type); DB::Names required_column_names = lambda_actions_dag.getRequiredColumnsNames(); - auto expression_actions_settings = DB::ExpressionActionsSettings::fromContext(getContext(), DB::CompileExpressions::yes); + auto expression_actions_settings = DB::ExpressionActionsSettings{getContext(), DB::CompileExpressions::yes}; auto function_capture = std::make_shared( std::move(lambda_actions_dag), expression_actions_settings, diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRepeat.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRepeat.cpp index 348917f9987b..0c20296a2e23 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRepeat.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/arrayRepeat.cpp @@ -71,7 +71,7 @@ class FunctionParserArrayRepeat : public FunctionParser NamesAndTypesList lambda_arguments_names_and_types; lambda_arguments_names_and_types.emplace_back(x_in_lambda->result_name, x_in_lambda->result_type); DB::Names required_column_names = lambda_actions_dag.getRequiredColumnsNames(); - auto expression_actions_settings = DB::ExpressionActionsSettings::fromContext(getContext(), DB::CompileExpressions::yes); + auto expression_actions_settings = DB::ExpressionActionsSettings{getContext(), DB::CompileExpressions::yes}; auto function_capture = std::make_shared( std::move(lambda_actions_dag), expression_actions_settings, diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/lambdaFunction.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/lambdaFunction.cpp index 556474397b57..79f3a3784a3a 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/lambdaFunction.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/lambdaFunction.cpp @@ -130,7 +130,7 @@ class FunctionParserLambda : public FunctionParser captured_column_names.push_back(required_column_name); } } - auto expression_actions_settings = DB::ExpressionActionsSettings::fromContext(getContext(), DB::CompileExpressions::yes); + auto expression_actions_settings = DB::ExpressionActionsSettings{getContext(), DB::CompileExpressions::yes}; auto function_capture = std::make_shared( std::move(lambda_actions_dag), expression_actions_settings, diff --git a/cpp-ch/local-engine/Storages/Cache/CacheManager.cpp b/cpp-ch/local-engine/Storages/Cache/CacheManager.cpp index f30e78dc91ce..f6421d1b2d22 100644 --- a/cpp-ch/local-engine/Storages/Cache/CacheManager.cpp +++ b/cpp-ch/local-engine/Storages/Cache/CacheManager.cpp @@ -132,7 +132,9 @@ Task CacheManager::cachePart( 1); QueryPlan plan; plan.addStep(std::move(read_step)); - auto pipeline_builder = plan.buildQueryPipeline({}, {}); + DB::QueryPlanOptimizationSettings optimization_settings{context}; + DB::BuildQueryPipelineSettings build_settings{context}; + auto pipeline_builder = plan.buildQueryPipeline(optimization_settings, build_settings); auto pipeline = QueryPipelineBuilder::getPipeline(std::move(*pipeline_builder.get())); PullingPipelineExecutor executor(pipeline); while (true) diff --git a/cpp-ch/local-engine/tests/gtest_ch_join.cpp b/cpp-ch/local-engine/tests/gtest_ch_join.cpp index 5df5eaff8c43..045d8d33c1a0 100644 --- a/cpp-ch/local-engine/tests/gtest_ch_join.cpp +++ b/cpp-ch/local-engine/tests/gtest_ch_join.cpp @@ -126,8 +126,8 @@ TEST(TestJoin, simple) } auto hash_join = std::make_shared(join, right_plan.getCurrentHeader()); - QueryPlanStepPtr join_step - = std::make_unique(left_plan.getCurrentHeader(), right_plan.getCurrentHeader(), hash_join, 8192, 8192, 1, NameSet{}, false, false); + QueryPlanStepPtr join_step = std::make_unique( + left_plan.getCurrentHeader(), right_plan.getCurrentHeader(), hash_join, 8192, 8192, 1, NameSet{}, false, false); std::cerr << "join step:" << join_step->getOutputHeader().dumpStructure() << std::endl; @@ -143,7 +143,8 @@ TEST(TestJoin, simple) {NameWithAlias("colA", "colA"), NameWithAlias("colB", "colB"), NameWithAlias("colD", "colD"), NameWithAlias("colC", "colC")}); QueryPlanStepPtr project_step = std::make_unique(query_plan.getCurrentHeader(), std::move(project)); query_plan.addStep(std::move(project_step)); - auto pipeline = query_plan.buildQueryPipeline(QueryPlanOptimizationSettings(), BuildQueryPipelineSettings()); + auto pipeline + = query_plan.buildQueryPipeline(QueryPlanOptimizationSettings{global_context}, BuildQueryPipelineSettings{global_context}); auto executable_pipe = QueryPipelineBuilder::getPipeline(std::move(*pipeline)); PullingPipelineExecutor executor(executable_pipe); auto res = pipeline->getHeader().cloneEmpty();