From f8c4599a5513d1f31f933b4cb1f5342506858b47 Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Fri, 13 Sep 2024 11:09:51 +0800 Subject: [PATCH] Fix UT build due to https://github.com/apache/incubator-gluten/pull/7193 --- cpp-ch/local-engine/Common/CHUtil.cpp | 2 -- cpp-ch/local-engine/Parser/LocalExecutor.cpp | 2 +- .../Parser/RelParsers/CrossRelParser.cpp | 1 - .../Parser/RelParsers/ExpandRelParser.cpp | 1 - .../Parser/RelParsers/FetchRelParser.cpp | 4 ++-- .../Parser/RelParsers/JoinRelParser.cpp | 1 - .../Parser/RelParsers/ReadRelParser.cpp | 14 ++++++++++++++ .../Parser/RelParsers/ReadRelParser.h | 16 ++-------------- .../Parser/RelParsers/RelParser.cpp | 4 +--- .../local-engine/Parser/RelParsers/RelParser.h | 18 +++++++++++------- .../RelParsers/WindowGroupLimitRelParser.h | 1 - .../Parser/SerializedPlanParser.cpp | 1 - cpp-ch/local-engine/Shuffle/PartitionWriter.h | 7 +++---- cpp-ch/local-engine/Shuffle/ShuffleCommon.cpp | 1 - .../local-engine/tests/gtest_ch_storages.cpp | 2 +- .../tests/gtest_write_pipeline.cpp | 2 +- .../tests/gtest_write_pipeline_mergetree.cpp | 2 +- 17 files changed, 37 insertions(+), 42 deletions(-) diff --git a/cpp-ch/local-engine/Common/CHUtil.cpp b/cpp-ch/local-engine/Common/CHUtil.cpp index 4d954950e6e09..4ec4ab376e6da 100644 --- a/cpp-ch/local-engine/Common/CHUtil.cpp +++ b/cpp-ch/local-engine/Common/CHUtil.cpp @@ -21,7 +21,6 @@ #include #include #include - #include #include #include @@ -52,7 +51,6 @@ #include #include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/LocalExecutor.cpp b/cpp-ch/local-engine/Parser/LocalExecutor.cpp index 1ae60e38ec26f..58c29b53c1cc5 100644 --- a/cpp-ch/local-engine/Parser/LocalExecutor.cpp +++ b/cpp-ch/local-engine/Parser/LocalExecutor.cpp @@ -18,7 +18,7 @@ #include "LocalExecutor.h" #include -#include +#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/RelParsers/CrossRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/CrossRelParser.cpp index 99ade18028a19..0236fbbd1dd2b 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/CrossRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/CrossRelParser.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp index aaf98baf2205e..451cd6ffc2a3e 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/cpp-ch/local-engine/Parser/RelParsers/FetchRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/FetchRelParser.cpp index 9594741a5e34c..d0847a5d8d548 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/FetchRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/FetchRelParser.cpp @@ -17,9 +17,9 @@ #include #include -#include +#include #include -#include "RelParser.h" + namespace local_engine { class FetchRelParser : public RelParser diff --git a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp index 39212cf8dcbf9..a5ed605ed0a20 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp index 5532baca53426..1f623ced57b1d 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp @@ -17,6 +17,20 @@ #include "ReadRelParser.h" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + namespace DB::ErrorCodes { diff --git a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.h b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.h index 8f9c578fba5e7..db3855306a555 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.h +++ b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.h @@ -15,24 +15,12 @@ * limitations under the License. */ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include namespace local_engine { + class ReadRelParser : public RelParser { public: diff --git a/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp index c5e7d4b4788b9..bf2658f881f52 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp @@ -17,12 +17,10 @@ #include "RelParser.h" #include -#include - #include #include #include -#include +#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/RelParsers/RelParser.h b/cpp-ch/local-engine/Parser/RelParsers/RelParser.h index 2e38c30c69d1e..522dc05d39f33 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/RelParser.h +++ b/cpp-ch/local-engine/Parser/RelParsers/RelParser.h @@ -27,6 +27,7 @@ #include #include #include + namespace local_engine { /// parse a single substrait relation @@ -52,34 +53,37 @@ class RelParser inline SerializedPlanParser * getPlanParser() const { return plan_parser; } inline ContextPtr getContext() const { return plan_parser->context; } - inline String getUniqueName(const std::string & name) { return plan_parser->getUniqueName(name); } + inline String getUniqueName(const std::string & name) const { return plan_parser->getUniqueName(name); } - inline const std::unordered_map & getFunctionMapping() { return plan_parser->function_mapping; } + inline const std::unordered_map & getFunctionMapping() const { return plan_parser->function_mapping; } // Get function signature name. std::optional parseSignatureFunctionName(UInt32 function_ref); // Get coresponding function name in ClickHouse. std::optional parseFunctionName(UInt32 function_ref, const substrait::Expression_ScalarFunction & function); - const DB::ActionsDAG::Node * parseArgument(ActionsDAG & action_dag, const substrait::Expression & rel) + const DB::ActionsDAG::Node * parseArgument(ActionsDAG & action_dag, const substrait::Expression & rel) const { return plan_parser->parseExpression(action_dag, rel); } - const DB::ActionsDAG::Node * parseExpression(ActionsDAG & action_dag, const substrait::Expression & rel) + const DB::ActionsDAG::Node * parseExpression(ActionsDAG & action_dag, const substrait::Expression & rel) const { return plan_parser->parseExpression(action_dag, rel); } - DB::ActionsDAG expressionsToActionsDAG(const std::vector & expressions, const DB::Block & header) + DB::ActionsDAG expressionsToActionsDAG(const std::vector & expressions, const DB::Block & header) const { return plan_parser->expressionsToActionsDAG(expressions, header, header); } - std::pair parseLiteral(const substrait::Expression_Literal & literal) { return plan_parser->parseLiteral(literal); } + std::pair parseLiteral(const substrait::Expression_Literal & literal) const + { + return plan_parser->parseLiteral(literal); + } // collect all steps for metrics std::vector steps; const ActionsDAG::Node * - buildFunctionNode(ActionsDAG & action_dag, const String & function, const DB::ActionsDAG::NodeRawConstPtrs & args) + buildFunctionNode(ActionsDAG & action_dag, const String & function, const DB::ActionsDAG::NodeRawConstPtrs & args) const { return plan_parser->toFunctionNode(action_dag, function, args); } diff --git a/cpp-ch/local-engine/Parser/RelParsers/WindowGroupLimitRelParser.h b/cpp-ch/local-engine/Parser/RelParsers/WindowGroupLimitRelParser.h index 7939d232ce9e8..6e0ef27f4e6ea 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/WindowGroupLimitRelParser.h +++ b/cpp-ch/local-engine/Parser/RelParsers/WindowGroupLimitRelParser.h @@ -17,7 +17,6 @@ #pragma once #include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp index 16b8e7c9e3604..f4aa38df599b6 100644 --- a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp +++ b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp @@ -83,7 +83,6 @@ #include #include #include -#include "RelParsers/RelParser.h" namespace DB { diff --git a/cpp-ch/local-engine/Shuffle/PartitionWriter.h b/cpp-ch/local-engine/Shuffle/PartitionWriter.h index 43f9987cf564d..80bb43b8d196c 100644 --- a/cpp-ch/local-engine/Shuffle/PartitionWriter.h +++ b/cpp-ch/local-engine/Shuffle/PartitionWriter.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,7 @@ friend class Spillable; PartitionWriter(const SplitOptions& options, LoggerPtr logger_); virtual ~PartitionWriter() = default; - void initialize(SplitResult * split_result_, const Block & output_header_) + void initialize(SplitResult * split_result_, const DB::Block & output_header_) { if (!init) { @@ -107,8 +106,8 @@ friend class Spillable; /// Only valid in celeborn partition writer size_t last_partition_id; - SplitResult* split_result = nullptr; - Block output_header; + SplitResult * split_result = nullptr; + DB::Block output_header; LoggerPtr logger = nullptr; bool init = false; }; diff --git a/cpp-ch/local-engine/Shuffle/ShuffleCommon.cpp b/cpp-ch/local-engine/Shuffle/ShuffleCommon.cpp index e0d8c0e84eaa4..418571874a305 100644 --- a/cpp-ch/local-engine/Shuffle/ShuffleCommon.cpp +++ b/cpp-ch/local-engine/Shuffle/ShuffleCommon.cpp @@ -16,7 +16,6 @@ */ #include #include -#include #include namespace local_engine diff --git a/cpp-ch/local-engine/tests/gtest_ch_storages.cpp b/cpp-ch/local-engine/tests/gtest_ch_storages.cpp index a3454f9b09599..28cea800ea93b 100644 --- a/cpp-ch/local-engine/tests/gtest_ch_storages.cpp +++ b/cpp-ch/local-engine/tests/gtest_ch_storages.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ #include -#include +#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp b/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp index 68c83aa8a8293..ed73b64f64690 100644 --- a/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp +++ b/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp @@ -22,8 +22,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_write_pipeline_mergetree.cpp b/cpp-ch/local-engine/tests/gtest_write_pipeline_mergetree.cpp index caf4481354336..4c99f18922520 100644 --- a/cpp-ch/local-engine/tests/gtest_write_pipeline_mergetree.cpp +++ b/cpp-ch/local-engine/tests/gtest_write_pipeline_mergetree.cpp @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include #include #include #include