diff --git a/cpp-ch/local-engine/Storages/Output/ORCOutputFormatFile.cpp b/cpp-ch/local-engine/Storages/Output/ORCOutputFormatFile.cpp index c54f2e7b33bf..b87b562fb1c0 100644 --- a/cpp-ch/local-engine/Storages/Output/ORCOutputFormatFile.cpp +++ b/cpp-ch/local-engine/Storages/Output/ORCOutputFormatFile.cpp @@ -37,7 +37,7 @@ OutputFormatFile::OutputFormatPtr ORCOutputFormatFile::createOutputFormat(const auto res = std::make_shared(); res->write_buffer = write_buffer_builder->build(file_uri); - auto new_header = creatHeaderWithPreferredSchema(header); + auto new_header = createHeaderWithPreferredSchema(header); // TODO: align all spark orc config with ch orc config auto format_settings = DB::getFormatSettings(context); auto output_format = std::make_shared(*(res->write_buffer), new_header, format_settings); diff --git a/cpp-ch/local-engine/Storages/Output/OutputFormatFile.cpp b/cpp-ch/local-engine/Storages/Output/OutputFormatFile.cpp index 1e8364c6dac2..ccb97326e866 100644 --- a/cpp-ch/local-engine/Storages/Output/OutputFormatFile.cpp +++ b/cpp-ch/local-engine/Storages/Output/OutputFormatFile.cpp @@ -43,7 +43,7 @@ OutputFormatFile::OutputFormatFile( { } -Block OutputFormatFile::creatHeaderWithPreferredSchema(const Block & header) +Block OutputFormatFile::createHeaderWithPreferredSchema(const Block & header) { if (!preferred_schema) throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "preferred_schema is empty"); @@ -61,7 +61,7 @@ Block OutputFormatFile::creatHeaderWithPreferredSchema(const Block & header) ColumnWithTypeAndName column(preferred_column.type->createColumn(), preferred_column.type, preferred_column.name); columns.emplace_back(std::move(column)); } - assert(preferred_column_names.size() == index); + assert(prefered_schema.columns() == index); return {std::move(columns)}; } diff --git a/cpp-ch/local-engine/Storages/Output/OutputFormatFile.h b/cpp-ch/local-engine/Storages/Output/OutputFormatFile.h index 93c26d7d188b..7dcffc867aa3 100644 --- a/cpp-ch/local-engine/Storages/Output/OutputFormatFile.h +++ b/cpp-ch/local-engine/Storages/Output/OutputFormatFile.h @@ -52,7 +52,7 @@ class OutputFormatFile virtual const DB::Block getPreferredSchema() const { return preferred_schema; } protected: - DB::Block creatHeaderWithPreferredSchema(const DB::Block & header); + DB::Block createHeaderWithPreferredSchema(const DB::Block & header); DB::ContextPtr context; std::string file_uri; diff --git a/cpp-ch/local-engine/Storages/Output/ParquetOutputFormatFile.cpp b/cpp-ch/local-engine/Storages/Output/ParquetOutputFormatFile.cpp index ea173b03cba5..f3ac41c19a5b 100644 --- a/cpp-ch/local-engine/Storages/Output/ParquetOutputFormatFile.cpp +++ b/cpp-ch/local-engine/Storages/Output/ParquetOutputFormatFile.cpp @@ -43,7 +43,7 @@ OutputFormatFile::OutputFormatPtr ParquetOutputFormatFile::createOutputFormat(co auto res = std::make_shared(); res->write_buffer = write_buffer_builder->build(file_uri); - auto new_header = creatHeaderWithPreferredSchema(header); + auto new_header = createHeaderWithPreferredSchema(header); // TODO: align all spark parquet config with ch parquet config auto format_settings = DB::getFormatSettings(context); auto output_format = std::make_shared(*(res->write_buffer), new_header, format_settings);