From 70368adbb0cf807e1e44991131710121f7756e81 Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Wed, 18 Sep 2024 13:25:52 +0800 Subject: [PATCH] Fix UT build due to https://github.com/apache/incubator-gluten/pull/6723 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 | 5 +---- .../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 - cpp-ch/local-engine/tests/gluten_test_util.cpp | 1 + .../local-engine/tests/gtest_ch_storages.cpp | 2 +- .../tests/gtest_clickhouse_pr_verify.cpp | 1 + .../local-engine/tests/gtest_local_engine.cpp | 1 - .../tests/gtest_parquet_columnindex.cpp | 8 ++------ .../tests/gtest_parquet_columnindex_bug.cpp | 3 ++- .../local-engine/tests/gtest_parquet_read.cpp | 3 +-- cpp-ch/local-engine/tests/gtest_parser.cpp | 5 +++-- .../tests/gtest_write_pipeline.cpp | 7 +++++-- 23 files changed, 50 insertions(+), 55 deletions(-) diff --git a/cpp-ch/local-engine/Common/CHUtil.cpp b/cpp-ch/local-engine/Common/CHUtil.cpp index b51683197c7e..5ad0b1b97384 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 @@ -53,7 +52,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 1ae60e38ec26..58c29b53c1cc 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 99ade18028a1..0236fbbd1dd2 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 aaf98baf2205..451cd6ffc2a3 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 9594741a5e34..d0847a5d8d54 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 39212cf8dcbf..a5ed605ed0a2 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 5532baca5342..1f623ced57b1 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 8f9c578fba5e..db3855306a55 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 813fadbb3e9e..dc36df0ad0f5 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/RelParser.cpp @@ -17,13 +17,10 @@ #include "RelParser.h" #include -#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 2e38c30c69d1..522dc05d39f3 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 7939d232ce9e..6e0ef27f4e6e 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 aa4bf5aac404..c1f00c334812 100644 --- a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp +++ b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp @@ -85,7 +85,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 43f9987cf564..80bb43b8d196 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 e0d8c0e84eaa..418571874a30 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/gluten_test_util.cpp b/cpp-ch/local-engine/tests/gluten_test_util.cpp index 66ce81a509a6..5e7e762d1e58 100644 --- a/cpp-ch/local-engine/tests/gluten_test_util.cpp +++ b/cpp-ch/local-engine/tests/gluten_test_util.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_ch_storages.cpp b/cpp-ch/local-engine/tests/gtest_ch_storages.cpp index a3454f9b0959..28cea800ea93 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_clickhouse_pr_verify.cpp b/cpp-ch/local-engine/tests/gtest_clickhouse_pr_verify.cpp index 012b4ebdddfc..b44fe5eae0f5 100644 --- a/cpp-ch/local-engine/tests/gtest_clickhouse_pr_verify.cpp +++ b/cpp-ch/local-engine/tests/gtest_clickhouse_pr_verify.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_local_engine.cpp b/cpp-ch/local-engine/tests/gtest_local_engine.cpp index 558f0df7a764..fd88075704ba 100644 --- a/cpp-ch/local-engine/tests/gtest_local_engine.cpp +++ b/cpp-ch/local-engine/tests/gtest_local_engine.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_parquet_columnindex.cpp b/cpp-ch/local-engine/tests/gtest_parquet_columnindex.cpp index 48ea16a4bc6f..ac0ec2145757 100644 --- a/cpp-ch/local-engine/tests/gtest_parquet_columnindex.cpp +++ b/cpp-ch/local-engine/tests/gtest_parquet_columnindex.cpp @@ -14,26 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - #include "config.h" #if USE_PARQUET #include #include #include #include -#include +#include #include #include #include -#include #include -#include #include #include #include #include #include +#include #include #include #include @@ -42,7 +39,6 @@ #include #include - # define ASSERT_DURATION_LE(secs, stmt) \ { \ std::promise completed; \ diff --git a/cpp-ch/local-engine/tests/gtest_parquet_columnindex_bug.cpp b/cpp-ch/local-engine/tests/gtest_parquet_columnindex_bug.cpp index 5e2be65528fe..51a5a0556ea8 100644 --- a/cpp-ch/local-engine/tests/gtest_parquet_columnindex_bug.cpp +++ b/cpp-ch/local-engine/tests/gtest_parquet_columnindex_bug.cpp @@ -18,9 +18,10 @@ #include #include #include -#include +#include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_parquet_read.cpp b/cpp-ch/local-engine/tests/gtest_parquet_read.cpp index e11343834459..1cbe34319d84 100644 --- a/cpp-ch/local-engine/tests/gtest_parquet_read.cpp +++ b/cpp-ch/local-engine/tests/gtest_parquet_read.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -32,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -44,6 +42,7 @@ #include #include #include +#include using namespace DB; diff --git a/cpp-ch/local-engine/tests/gtest_parser.cpp b/cpp-ch/local-engine/tests/gtest_parser.cpp index 5f8d482d5828..b6c431ff25f3 100644 --- a/cpp-ch/local-engine/tests/gtest_parser.cpp +++ b/cpp-ch/local-engine/tests/gtest_parser.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -45,8 +46,8 @@ TEST(LocalExecutor, ReadCSV) auto plan = local_engine::JsonStringToMessage(EMBEDDED_PLAN(_readcsv_plan)); auto query_plan = parser.parse(plan); - const auto pipeline = parser.buildQueryPipeline(*query_plan); - LocalExecutor local_executor{std::move(query_plan), QueryPipelineBuilder::getPipeline(std::move(*pipeline))}; + auto pipeline = parser.buildQueryPipeline(*query_plan); + LocalExecutor local_executor{std::move(query_plan), std::move(pipeline)}; EXPECT_TRUE(local_executor.hasNext()); const Block & x = *local_executor.nextColumnar(); diff --git a/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp b/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp index 3db6f2fd4cb9..18a18b0e2cbf 100644 --- a/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp +++ b/cpp-ch/local-engine/tests/gtest_write_pipeline.cpp @@ -19,18 +19,20 @@ #include #include #include +#include #include #include #include #include -#include +#include +#include #include #include -#include #include #include #include #include +#include #include #include #include @@ -40,6 +42,7 @@ #include #include #include +#include #include #include #include