From 1da0aab444798eeb1038ee5d13a626f8a0186a71 Mon Sep 17 00:00:00 2001 From: kyligence-git Date: Thu, 6 Feb 2025 23:08:52 +0000 Subject: [PATCH 1/3] [GLUTEN-1632][CH]Daily Update Clickhouse Version (20250207) --- cpp-ch/clickhouse.version | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp-ch/clickhouse.version b/cpp-ch/clickhouse.version index 45a2eb06c300..e406bff3fcd7 100644 --- a/cpp-ch/clickhouse.version +++ b/cpp-ch/clickhouse.version @@ -1,3 +1,3 @@ CH_ORG=Kyligence -CH_BRANCH=rebase_ch/20250205 -CH_COMMIT=c1451130e6d +CH_BRANCH=rebase_ch/20250207 +CH_COMMIT=8501f74afef From 2a9c3992ae138ba92c44404ceea6ad6069c5473c Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Fri, 7 Feb 2025 12:59:04 +0800 Subject: [PATCH 2/3] Fix build due to https://github.com/ClickHouse/ClickHouse/pull/75299 --- cpp-ch/clickhouse.version | 2 +- cpp-ch/local-engine/Common/ChunkBuffer.cpp | 2 ++ .../Functions/FunctionsBloomFilter.h | 2 +- .../local-engine/Functions/SparkArrayFlatten.cpp | 9 +++++---- .../Functions/SparkFunctionArraySort.cpp | 10 +++++----- .../SparkFunctionCheckDecimalOverflow.cpp | 3 ++- .../local-engine/Functions/SparkFunctionFloor.h | 1 + .../Functions/SparkFunctionMakeDecimal.cpp | 2 ++ .../Functions/SparkFunctionMapToString.h | 3 ++- .../Functions/SparkFunctionToDateTime.h | 1 + .../Functions/SparkFunctionTupleElement.cpp | 3 ++- .../Functions/SparkFunctionUnscaleValue.cpp | 1 + .../local-engine/Operator/AdvancedExpandStep.cpp | 8 +++----- .../Operator/PartitionColumnFillingTransform.cpp | 3 ++- .../local-engine/Operator/ReplicateRowsStep.cpp | 3 +-- .../Operator/WindowGroupLimitStep.cpp | 1 + .../Parser/AggregateFunctionParser.cpp | 1 + .../Parser/RelParsers/ExpandRelParser.cpp | 16 +++++----------- .../Parser/RelParsers/ReadRelParser.cpp | 4 +++- cpp-ch/local-engine/Shuffle/PartitionWriter.cpp | 1 + cpp-ch/local-engine/Shuffle/SelectorBuilder.h | 4 +--- .../Storages/Output/NormalFileWriter.cpp | 1 + .../Serializations/ExcelDecimalSerialization.h | 8 ++++++++ .../Storages/Serializations/ExcelSerialization.h | 1 + .../Storages/SubstraitSource/FormatFile.cpp | 1 + cpp-ch/local-engine/tests/gtest_transformer.cpp | 1 + 26 files changed, 55 insertions(+), 37 deletions(-) diff --git a/cpp-ch/clickhouse.version b/cpp-ch/clickhouse.version index e406bff3fcd7..72d0685e152a 100644 --- a/cpp-ch/clickhouse.version +++ b/cpp-ch/clickhouse.version @@ -1,3 +1,3 @@ CH_ORG=Kyligence CH_BRANCH=rebase_ch/20250207 -CH_COMMIT=8501f74afef +CH_COMMIT=b6c11f40aed diff --git a/cpp-ch/local-engine/Common/ChunkBuffer.cpp b/cpp-ch/local-engine/Common/ChunkBuffer.cpp index 9477a61a8647..629b83c059a3 100644 --- a/cpp-ch/local-engine/Common/ChunkBuffer.cpp +++ b/cpp-ch/local-engine/Common/ChunkBuffer.cpp @@ -16,6 +16,8 @@ */ #include "ChunkBuffer.h" +#include + namespace local_engine { void ChunkBuffer::add(DB::Chunk & columns, int start, int end) diff --git a/cpp-ch/local-engine/Functions/FunctionsBloomFilter.h b/cpp-ch/local-engine/Functions/FunctionsBloomFilter.h index d677a3311c8d..2546030db505 100644 --- a/cpp-ch/local-engine/Functions/FunctionsBloomFilter.h +++ b/cpp-ch/local-engine/Functions/FunctionsBloomFilter.h @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Functions/SparkArrayFlatten.cpp b/cpp-ch/local-engine/Functions/SparkArrayFlatten.cpp index d39bca5ea104..96faa9d1dc1d 100644 --- a/cpp-ch/local-engine/Functions/SparkArrayFlatten.cpp +++ b/cpp-ch/local-engine/Functions/SparkArrayFlatten.cpp @@ -14,12 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include namespace DB diff --git a/cpp-ch/local-engine/Functions/SparkFunctionArraySort.cpp b/cpp-ch/local-engine/Functions/SparkFunctionArraySort.cpp index cf9d67f1696b..c53d9dbd319b 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionArraySort.cpp +++ b/cpp-ch/local-engine/Functions/SparkFunctionArraySort.cpp @@ -14,18 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include #include #include #include -#include #include #include #include -#include -#include +#include +#include +#include #include +#include +#include namespace DB::ErrorCodes { diff --git a/cpp-ch/local-engine/Functions/SparkFunctionCheckDecimalOverflow.cpp b/cpp-ch/local-engine/Functions/SparkFunctionCheckDecimalOverflow.cpp index 73fc7b5d4e40..95853b187a42 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionCheckDecimalOverflow.cpp +++ b/cpp-ch/local-engine/Functions/SparkFunctionCheckDecimalOverflow.cpp @@ -16,16 +16,17 @@ */ #include "SparkFunctionCheckDecimalOverflow.h" +#include #include #include #include #include +#include #include #include #include #include #include -#include namespace DB { diff --git a/cpp-ch/local-engine/Functions/SparkFunctionFloor.h b/cpp-ch/local-engine/Functions/SparkFunctionFloor.h index a2db1083e1df..a56c33baddcf 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionFloor.h +++ b/cpp-ch/local-engine/Functions/SparkFunctionFloor.h @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Functions/SparkFunctionMakeDecimal.cpp b/cpp-ch/local-engine/Functions/SparkFunctionMakeDecimal.cpp index f136f587c539..7ffb390bc899 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionMakeDecimal.cpp +++ b/cpp-ch/local-engine/Functions/SparkFunctionMakeDecimal.cpp @@ -16,6 +16,8 @@ */ #include #include +#include +#include #include #include #include diff --git a/cpp-ch/local-engine/Functions/SparkFunctionMapToString.h b/cpp-ch/local-engine/Functions/SparkFunctionMapToString.h index 739f9536d6f8..6c49d3c18da8 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionMapToString.h +++ b/cpp-ch/local-engine/Functions/SparkFunctionMapToString.h @@ -15,10 +15,11 @@ * limitations under the License. */ #pragma once -#include + #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Functions/SparkFunctionToDateTime.h b/cpp-ch/local-engine/Functions/SparkFunctionToDateTime.h index 15c23041d944..aae0a359f59e 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionToDateTime.h +++ b/cpp-ch/local-engine/Functions/SparkFunctionToDateTime.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Functions/SparkFunctionTupleElement.cpp b/cpp-ch/local-engine/Functions/SparkFunctionTupleElement.cpp index 53c48b97c7bc..d52abde2ccfd 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionTupleElement.cpp +++ b/cpp-ch/local-engine/Functions/SparkFunctionTupleElement.cpp @@ -16,17 +16,18 @@ */ #include #include +#include #include #include #include #include +#include #include #include #include #include #include #include -#include "Columns/ColumnNullable.h" namespace DB diff --git a/cpp-ch/local-engine/Functions/SparkFunctionUnscaleValue.cpp b/cpp-ch/local-engine/Functions/SparkFunctionUnscaleValue.cpp index 33ec2e308a3e..c964482c897e 100644 --- a/cpp-ch/local-engine/Functions/SparkFunctionUnscaleValue.cpp +++ b/cpp-ch/local-engine/Functions/SparkFunctionUnscaleValue.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Operator/AdvancedExpandStep.cpp b/cpp-ch/local-engine/Operator/AdvancedExpandStep.cpp index 72721ce85921..458e8d5a7c23 100644 --- a/cpp-ch/local-engine/Operator/AdvancedExpandStep.cpp +++ b/cpp-ch/local-engine/Operator/AdvancedExpandStep.cpp @@ -16,8 +16,9 @@ */ #include "AdvancedExpandStep.h" + +#include #include -#include #include #include #include @@ -27,14 +28,11 @@ #include #include #include -#include #include #include +#include #include #include -#include - -#include #include namespace local_engine diff --git a/cpp-ch/local-engine/Operator/PartitionColumnFillingTransform.cpp b/cpp-ch/local-engine/Operator/PartitionColumnFillingTransform.cpp index ab87e1b39b79..d0e2a4b3b620 100644 --- a/cpp-ch/local-engine/Operator/PartitionColumnFillingTransform.cpp +++ b/cpp-ch/local-engine/Operator/PartitionColumnFillingTransform.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ #include "PartitionColumnFillingTransform.h" -#include + #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Operator/ReplicateRowsStep.cpp b/cpp-ch/local-engine/Operator/ReplicateRowsStep.cpp index 705e4136751f..5281ce4a5f8a 100644 --- a/cpp-ch/local-engine/Operator/ReplicateRowsStep.cpp +++ b/cpp-ch/local-engine/Operator/ReplicateRowsStep.cpp @@ -16,8 +16,7 @@ */ #include "ReplicateRowsStep.h" -#include - +#include #include namespace DB diff --git a/cpp-ch/local-engine/Operator/WindowGroupLimitStep.cpp b/cpp-ch/local-engine/Operator/WindowGroupLimitStep.cpp index d2264e24dc13..a0b623b7cc62 100644 --- a/cpp-ch/local-engine/Operator/WindowGroupLimitStep.cpp +++ b/cpp-ch/local-engine/Operator/WindowGroupLimitStep.cpp @@ -17,6 +17,7 @@ #include "WindowGroupLimitStep.h" +#include #include #include #include diff --git a/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp b/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp index e02af53d3709..696f5352f200 100644 --- a/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp +++ b/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp @@ -18,6 +18,7 @@ #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 f3d8b4ab11ec..7d31fcf2bca1 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/ExpandRelParser.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ #include "ExpandRelParser.h" -#include + #include +#include #include #include #include @@ -41,9 +42,7 @@ ExpandRelParser::ExpandRelParser(ParserContextPtr parser_context_) : RelParser(p void updateType(DB::DataTypePtr & type, const DB::DataTypePtr & new_type) { if (type == nullptr || (!type->isNullable() && new_type->isNullable())) - { type = new_type; - } } DB::QueryPlanPtr @@ -91,7 +90,8 @@ ExpandField ExpandRelParser::buildExpandField(const DB::Block & header, const su fields.push_back(field); if (field >= header.columns()) { - throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Field index out of range: {}, header: {}", field, header.dumpStructure()); + throw DB::Exception( + DB::ErrorCodes::LOGICAL_ERROR, "Field index out of range: {}, header: {}", field, header.dumpStructure()); } updateType(types[i], header.getByPosition(field).type); const auto & name = header.getByPosition(field).name; @@ -128,10 +128,8 @@ ExpandField ExpandRelParser::buildExpandField(const DB::Block & header, const su } for (int i = 0; i < names.size(); ++i) - { if (names[i].empty()) names[i] = getUniqueName("expand_" + std::to_string(i)); - } ExpandField expand_field(names, types, expand_kinds, expand_fields); return expand_field; @@ -144,10 +142,8 @@ bool ExpandRelParser::isLazyAggregateExpand(const substrait::ExpandRel & expand_ return false; const auto & aggregate_rel = input_rel.aggregate(); for (const auto & measure : aggregate_rel.measures()) - { if (measure.measure().phase() != substrait::AggregationPhase::AGGREGATION_PHASE_INITIAL_TO_INTERMEDIATE) return false; - } return true; } @@ -172,7 +168,7 @@ DB::QueryPlanPtr ExpandRelParser::lazyAggregateExpandParse( auto aggregate_rel = rel.expand().input().aggregate(); auto aggregate_descriptions = buildAggregations(input_header, expand_field, aggregate_rel); - size_t grouping_keys = aggregate_rel.groupings(0).grouping_expressions_size(); + size_t grouping_keys = aggregate_rel.groupings(0).grouping_expressions_size(); auto expand_step = std::make_unique(getContext(), input_header, grouping_keys, aggregate_descriptions, expand_field); @@ -189,10 +185,8 @@ DB::AggregateDescriptions ExpandRelParser::buildAggregations( DB::AggregateDescriptions descriptions; DB::ColumnsWithTypeAndName aggregate_columns; for (const auto & col : header.getColumnsWithTypeAndName()) - { if (typeid_cast(col.column.get())) aggregate_columns.push_back(col); - } for (size_t i = 0; i < aggregate_rel.measures_size(); ++i) { diff --git a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp index 0a663a88a6cf..8056d26b2eb6 100644 --- a/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp +++ b/cpp-ch/local-engine/Parser/RelParsers/ReadRelParser.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,8 @@ extern const int LOGICAL_ERROR; namespace local_engine { using namespace DB; -DB::QueryPlanPtr ReadRelParser::parse(DB::QueryPlanPtr query_plan, const substrait::Rel & rel, std::list & rel_stack) +DB::QueryPlanPtr +ReadRelParser::parse(DB::QueryPlanPtr query_plan, const substrait::Rel & rel, std::list & rel_stack) { if (query_plan) throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Source node's input plan should be null"); diff --git a/cpp-ch/local-engine/Shuffle/PartitionWriter.cpp b/cpp-ch/local-engine/Shuffle/PartitionWriter.cpp index 158f1a9cfa0e..ebda09a4e68b 100644 --- a/cpp-ch/local-engine/Shuffle/PartitionWriter.cpp +++ b/cpp-ch/local-engine/Shuffle/PartitionWriter.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace DB { diff --git a/cpp-ch/local-engine/Shuffle/SelectorBuilder.h b/cpp-ch/local-engine/Shuffle/SelectorBuilder.h index 7349849f538e..b972e0a516c4 100644 --- a/cpp-ch/local-engine/Shuffle/SelectorBuilder.h +++ b/cpp-ch/local-engine/Shuffle/SelectorBuilder.h @@ -17,17 +17,15 @@ #pragma once #include #include +#include #include -#include #include #include -#include #include #include #include #include #include -#include #include namespace local_engine diff --git a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp index 1f3d7f0b2598..0b84c27cf3ba 100644 --- a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp +++ b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Storages/Serializations/ExcelDecimalSerialization.h b/cpp-ch/local-engine/Storages/Serializations/ExcelDecimalSerialization.h index 351e4458ab57..29bafe0a9059 100644 --- a/cpp-ch/local-engine/Storages/Serializations/ExcelDecimalSerialization.h +++ b/cpp-ch/local-engine/Storages/Serializations/ExcelDecimalSerialization.h @@ -19,6 +19,14 @@ #include #include +namespace DB +{ +namespace ErrorCodes +{ +extern const int NOT_IMPLEMENTED; +} +} + namespace local_engine { diff --git a/cpp-ch/local-engine/Storages/Serializations/ExcelSerialization.h b/cpp-ch/local-engine/Storages/Serializations/ExcelSerialization.h index a7215b3490eb..f55d7df9cbf6 100644 --- a/cpp-ch/local-engine/Storages/Serializations/ExcelSerialization.h +++ b/cpp-ch/local-engine/Storages/Serializations/ExcelSerialization.h @@ -26,6 +26,7 @@ namespace DB namespace ErrorCodes { extern const int ATTEMPT_TO_READ_AFTER_EOF; + extern const int NOT_IMPLEMENTED; } } diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp b/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp index 0fb5294e6073..cc6366785677 100644 --- a/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp +++ b/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp @@ -17,6 +17,7 @@ #include "FormatFile.h" #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/tests/gtest_transformer.cpp b/cpp-ch/local-engine/tests/gtest_transformer.cpp index a4d62d5681a3..d6ed2d8ef8d4 100644 --- a/cpp-ch/local-engine/tests/gtest_transformer.cpp +++ b/cpp-ch/local-engine/tests/gtest_transformer.cpp @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include #include From c4f0a37f9e66335f844d4c9f522adc8290a2cce4 Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Fri, 7 Feb 2025 12:45:58 +0800 Subject: [PATCH 3/3] Fix build due to https://github.com/ClickHouse/ClickHouse/pull/75636 --- cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp | 1 + cpp-ch/local-engine/Storages/Output/NormalFileWriter.h | 1 + 2 files changed, 2 insertions(+) diff --git a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp index 0b84c27cf3ba..546a29be711b 100644 --- a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp +++ b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.h b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.h index d12ccaae6062..c337a50f75d3 100644 --- a/cpp-ch/local-engine/Storages/Output/NormalFileWriter.h +++ b/cpp-ch/local-engine/Storages/Output/NormalFileWriter.h @@ -16,6 +16,7 @@ */ #pragma once +#include #include #include #include