From c0e029bb1b228dbce439ad43c140dee852e45010 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 17 Jul 2015 04:27:35 +0300 Subject: [PATCH] dbms: renamed ColumnWithNameAndType to ColumnWithTypeAndName for clarification [#METR-2944]. --- dbms/include/DB/Common/ExternalTable.h | 2 +- dbms/include/DB/Common/VirtualColumnUtils.h | 2 +- dbms/include/DB/Core/Block.h | 28 ++++++------ ...hNameAndType.h => ColumnWithTypeAndName.h} | 12 ++--- dbms/include/DB/Core/ColumnsWithNameAndType.h | 13 ------ dbms/include/DB/Core/ColumnsWithTypeAndName.h | 13 ++++++ .../AddingConstColumnBlockInputStream.h | 4 +- dbms/include/DB/DataTypes/DataTypeTuple.h | 2 +- .../DB/Dictionaries/DictionarySourceFactory.h | 4 +- dbms/include/DB/Functions/FunctionsArray.h | 4 +- .../DB/Functions/FunctionsConversion.h | 6 +-- dbms/include/DB/Functions/FunctionsHashing.h | 2 +- .../DB/Functions/FunctionsHigherOrder.h | 6 +-- .../DB/Functions/FunctionsMiscellaneous.h | 2 +- dbms/include/DB/Functions/IFunction.h | 4 +- .../DB/Interpreters/ExpressionActions.h | 10 ++--- .../Interpreters/InterpreterDescribeQuery.h | 10 ++--- .../DB/Interpreters/InterpreterExistsQuery.h | 4 +- .../Interpreters/InterpreterShowCreateQuery.h | 4 +- .../MergeTree/MergeTreeBlockInputStream.h | 2 +- .../DB/Storages/MergeTree/MergeTreeReader.h | 6 +-- .../MergeTree/MergedBlockOutputStream.h | 6 +-- dbms/src/Core/Block.cpp | 20 ++++----- .../AggregatingSortedBlockInputStream.cpp | 2 +- .../DataStreams/FilterBlockInputStream.cpp | 4 +- .../JSONCompactRowOutputStream.cpp | 4 +- dbms/src/DataStreams/JSONRowOutputStream.cpp | 4 +- .../DataStreams/NativeBlockInputStream.cpp | 2 +- .../DataStreams/NativeBlockOutputStream.cpp | 2 +- .../DataStreams/PrettyBlockOutputStream.cpp | 6 +-- .../PrettyCompactBlockOutputStream.cpp | 4 +- .../PrettySpaceBlockOutputStream.cpp | 4 +- .../SummingSortedBlockInputStream.cpp | 2 +- .../TabSeparatedBlockOutputStream.cpp | 2 +- .../TotalsHavingBlockInputStream.cpp | 10 ++--- .../DataStreams/tests/aggregating_stream.cpp | 8 ++-- .../tests/block_row_transforms.cpp | 6 +-- .../tests/block_tab_separated_streams.cpp | 2 +- .../tests/collapsing_sorted_stream.cpp | 8 ++-- dbms/src/DataStreams/tests/json_streams.cpp | 2 +- dbms/src/DataStreams/tests/sorting_stream.cpp | 2 +- .../tests/tab_separated_streams.cpp | 4 +- dbms/src/Functions/FunctionsMiscellaneous.cpp | 8 ++-- .../Functions/tests/functions_arithmetic.cpp | 6 +-- .../tests/logical_functions_performance.cpp | 4 +- dbms/src/Interpreters/Aggregator.cpp | 4 +- dbms/src/Interpreters/ExpressionActions.cpp | 38 ++++++++-------- dbms/src/Interpreters/ExpressionAnalyzer.cpp | 14 +++--- .../Interpreters/InterpreterInsertQuery.cpp | 2 +- .../Interpreters/InterpreterSelectQuery.cpp | 2 +- dbms/src/Interpreters/Join.cpp | 8 ++-- dbms/src/Interpreters/Set.cpp | 2 +- dbms/src/Interpreters/tests/aggregate.cpp | 6 +-- dbms/src/Interpreters/tests/expression.cpp | 6 +-- dbms/src/Storages/ITableDeclaration.cpp | 2 +- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 2 +- .../MergeTree/MergeTreeDataSelectExecutor.cpp | 2 +- dbms/src/Storages/MergeTree/PKCondition.cpp | 2 +- dbms/src/Storages/StorageBuffer.cpp | 2 +- dbms/src/Storages/StorageChunkMerger.cpp | 2 +- dbms/src/Storages/StorageChunks.cpp | 2 +- dbms/src/Storages/StorageLog.cpp | 6 +-- dbms/src/Storages/StorageMerge.cpp | 2 +- .../Storages/StorageReplicatedMergeTree.cpp | 2 +- dbms/src/Storages/StorageSystemClusters.cpp | 16 +++---- dbms/src/Storages/StorageSystemColumns.cpp | 16 +++---- dbms/src/Storages/StorageSystemDatabases.cpp | 2 +- .../Storages/StorageSystemDictionaries.cpp | 28 ++++++------ dbms/src/Storages/StorageSystemEvents.cpp | 4 +- dbms/src/Storages/StorageSystemFunctions.cpp | 4 +- dbms/src/Storages/StorageSystemMerges.cpp | 24 +++++----- dbms/src/Storages/StorageSystemNumbers.cpp | 2 +- dbms/src/Storages/StorageSystemOne.cpp | 2 +- dbms/src/Storages/StorageSystemParts.cpp | 44 +++++++++---------- dbms/src/Storages/StorageSystemProcesses.cpp | 18 ++++---- dbms/src/Storages/StorageSystemReplicas.cpp | 44 +++++++++---------- dbms/src/Storages/StorageSystemSettings.cpp | 6 +-- dbms/src/Storages/StorageSystemTables.cpp | 12 ++--- dbms/src/Storages/StorageSystemZooKeeper.cpp | 28 ++++++------ dbms/src/Storages/StorageTinyLog.cpp | 4 +- dbms/src/Storages/tests/hit_log.cpp | 2 +- dbms/src/Storages/tests/merge_tree.cpp | 8 ++-- dbms/src/Storages/tests/storage_log.cpp | 8 ++-- dbms/src/Storages/tests/system_numbers.cpp | 2 +- 84 files changed, 321 insertions(+), 321 deletions(-) rename dbms/include/DB/Core/{ColumnWithNameAndType.h => ColumnWithTypeAndName.h} (74%) delete mode 100644 dbms/include/DB/Core/ColumnsWithNameAndType.h create mode 100644 dbms/include/DB/Core/ColumnsWithTypeAndName.h diff --git a/dbms/include/DB/Common/ExternalTable.h b/dbms/include/DB/Common/ExternalTable.h index 43f3e838a8b..53d543a555a 100644 --- a/dbms/include/DB/Common/ExternalTable.h +++ b/dbms/include/DB/Common/ExternalTable.h @@ -47,7 +47,7 @@ public: for (size_t i = 0; i < structure.size(); ++i) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.name = structure[i].first; column.type = data_type_factory.get(structure[i].second); column.column = column.type->createColumn(); diff --git a/dbms/include/DB/Common/VirtualColumnUtils.h b/dbms/include/DB/Common/VirtualColumnUtils.h index a4848d5e17b..87145c95851 100644 --- a/dbms/include/DB/Common/VirtualColumnUtils.h +++ b/dbms/include/DB/Common/VirtualColumnUtils.h @@ -37,7 +37,7 @@ template std::multiset extractSingleValueFromBlock(const Block & block, const String & name) { std::multiset res; - const ColumnWithNameAndType & data = block.getByName(name); + const ColumnWithTypeAndName & data = block.getByName(name); size_t rows = block.rows(); for (size_t i = 0; i < rows; ++i) res.insert((*data.column)[i].get()); diff --git a/dbms/include/DB/Core/Block.h b/dbms/include/DB/Core/Block.h index 313bac80a5c..e72f903a9d3 100644 --- a/dbms/include/DB/Core/Block.h +++ b/dbms/include/DB/Core/Block.h @@ -6,11 +6,11 @@ #include #include -#include +#include #include #include #include -#include "ColumnsWithNameAndType.h" +#include "ColumnsWithTypeAndName.h" namespace DB @@ -26,7 +26,7 @@ class Context; class Block { public: - typedef std::list Container_t; + typedef std::list Container_t; typedef std::vector IndexByPosition_t; typedef std::map IndexByName_t; @@ -39,7 +39,7 @@ public: BlockInfo info; Block() = default; - Block(std::initializer_list il) : data{il} + Block(std::initializer_list il) : data{il} { index_by_position.reserve(il.size()); for (auto it = std::begin(data); it != std::end(data); ++it) @@ -56,11 +56,11 @@ public: Block & operator= (Block && other) = default; /// вставить столбец в заданную позицию - void insert(size_t position, const ColumnWithNameAndType & elem); + void insert(size_t position, const ColumnWithTypeAndName & elem); /// вставить столбец в конец - void insert(const ColumnWithNameAndType & elem); + void insert(const ColumnWithTypeAndName & elem); /// вставить столбец в конец, если столбца с таким именем ещё нет - void insertUnique(const ColumnWithNameAndType & elem); + void insertUnique(const ColumnWithTypeAndName & elem); /// удалить столбец в заданной позиции void erase(size_t position); /// удалить столбец с заданным именем @@ -68,20 +68,20 @@ public: /// Добавляет в блок недостающие столбцы со значениями по-умолчанию void addDefaults(const NamesAndTypesList & required_columns); - ColumnWithNameAndType & getByPosition(size_t position); - const ColumnWithNameAndType & getByPosition(size_t position) const; + ColumnWithTypeAndName & getByPosition(size_t position); + const ColumnWithTypeAndName & getByPosition(size_t position) const; - ColumnWithNameAndType & unsafeGetByPosition(size_t position) { return *index_by_position[position]; } - const ColumnWithNameAndType & unsafeGetByPosition(size_t position) const { return *index_by_position[position]; } + ColumnWithTypeAndName & unsafeGetByPosition(size_t position) { return *index_by_position[position]; } + const ColumnWithTypeAndName & unsafeGetByPosition(size_t position) const { return *index_by_position[position]; } - ColumnWithNameAndType & getByName(const std::string & name); - const ColumnWithNameAndType & getByName(const std::string & name) const; + ColumnWithTypeAndName & getByName(const std::string & name); + const ColumnWithTypeAndName & getByName(const std::string & name) const; bool has(const std::string & name) const; size_t getPositionByName(const std::string & name) const; - ColumnsWithNameAndType getColumns() const; + ColumnsWithTypeAndName getColumns() const; NamesAndTypesList getColumnsList() const; /** Возвращает количество строк в блоке. diff --git a/dbms/include/DB/Core/ColumnWithNameAndType.h b/dbms/include/DB/Core/ColumnWithTypeAndName.h similarity index 74% rename from dbms/include/DB/Core/ColumnWithNameAndType.h rename to dbms/include/DB/Core/ColumnWithTypeAndName.h index 277e5b3ae0c..a746c9246dd 100644 --- a/dbms/include/DB/Core/ColumnWithNameAndType.h +++ b/dbms/include/DB/Core/ColumnWithTypeAndName.h @@ -14,19 +14,19 @@ using Poco::SharedPtr; /** Тип данных для представления столбца вместе с его типом и именем в оперативке. */ -struct ColumnWithNameAndType +struct ColumnWithTypeAndName { ColumnPtr column; DataTypePtr type; String name; - - ColumnWithNameAndType() {} - ColumnWithNameAndType(const ColumnPtr & column_, const DataTypePtr & type_, const String name_) + + ColumnWithTypeAndName() {} + ColumnWithTypeAndName(const ColumnPtr & column_, const DataTypePtr & type_, const String name_) : column(column_), type(type_), name(name_) {} - ColumnWithNameAndType cloneEmpty() const + ColumnWithTypeAndName cloneEmpty() const { - ColumnWithNameAndType res; + ColumnWithTypeAndName res; res.name = name; res.type = type->clone(); diff --git a/dbms/include/DB/Core/ColumnsWithNameAndType.h b/dbms/include/DB/Core/ColumnsWithNameAndType.h deleted file mode 100644 index ae55d4d6b85..00000000000 --- a/dbms/include/DB/Core/ColumnsWithNameAndType.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -#include - - -namespace DB -{ - -typedef std::vector ColumnsWithNameAndType; - -} diff --git a/dbms/include/DB/Core/ColumnsWithTypeAndName.h b/dbms/include/DB/Core/ColumnsWithTypeAndName.h new file mode 100644 index 00000000000..55268609c89 --- /dev/null +++ b/dbms/include/DB/Core/ColumnsWithTypeAndName.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +#include + + +namespace DB +{ + +typedef std::vector ColumnsWithTypeAndName; + +} diff --git a/dbms/include/DB/DataStreams/AddingConstColumnBlockInputStream.h b/dbms/include/DB/DataStreams/AddingConstColumnBlockInputStream.h index b600857d007..2ed11a07746 100644 --- a/dbms/include/DB/DataStreams/AddingConstColumnBlockInputStream.h +++ b/dbms/include/DB/DataStreams/AddingConstColumnBlockInputStream.h @@ -4,7 +4,7 @@ #include #include -#include +#include namespace DB { @@ -41,7 +41,7 @@ protected: if (!res) return res; ColumnPtr column_ptr = ColumnConst(res.rows(), value, data_type).convertToFullColumn(); - ColumnWithNameAndType column(column_ptr, data_type, column_name); + ColumnWithTypeAndName column(column_ptr, data_type, column_name); res.insert(column); return res; } diff --git a/dbms/include/DB/DataTypes/DataTypeTuple.h b/dbms/include/DB/DataTypes/DataTypeTuple.h index db9dd5bdb09..c5554effa30 100644 --- a/dbms/include/DB/DataTypes/DataTypeTuple.h +++ b/dbms/include/DB/DataTypes/DataTypeTuple.h @@ -136,7 +136,7 @@ public: Block tuple_block; for (size_t i = 0, size = elems.size(); i < size; ++i) { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.column = elems[i]->createColumn(); col.type = elems[i]->clone(); tuple_block.insert(col); diff --git a/dbms/include/DB/Dictionaries/DictionarySourceFactory.h b/dbms/include/DB/Dictionaries/DictionarySourceFactory.h index fc5992fbe9e..b2b73faf24a 100644 --- a/dbms/include/DB/Dictionaries/DictionarySourceFactory.h +++ b/dbms/include/DB/Dictionaries/DictionarySourceFactory.h @@ -18,7 +18,7 @@ namespace Block createSampleBlock(const DictionaryStructure & dict_struct) { Block block{ - ColumnWithNameAndType{ + ColumnWithTypeAndName{ new ColumnUInt64, new DataTypeUInt64, dict_struct.id_name @@ -26,7 +26,7 @@ Block createSampleBlock(const DictionaryStructure & dict_struct) }; for (const auto & attribute : dict_struct.attributes) - block.insert(ColumnWithNameAndType{ + block.insert(ColumnWithTypeAndName{ attribute.type->createColumn(), attribute.type, attribute.name }); diff --git a/dbms/include/DB/Functions/FunctionsArray.h b/dbms/include/DB/Functions/FunctionsArray.h index f58582b81c9..f21b3c1211f 100644 --- a/dbms/include/DB/Functions/FunctionsArray.h +++ b/dbms/include/DB/Functions/FunctionsArray.h @@ -634,12 +634,12 @@ private: for (size_t i = 0; i < tuple_size; ++i) { - ColumnWithNameAndType array_of_tuple_section; + ColumnWithTypeAndName array_of_tuple_section; array_of_tuple_section.column = new ColumnArray(tuple_block.getByPosition(i).column, col_array->getOffsetsColumn()); array_of_tuple_section.type = new DataTypeArray(tuple_block.getByPosition(i).type); block_of_temporary_results.insert(array_of_tuple_section); - ColumnWithNameAndType array_elements_of_tuple_section; + ColumnWithTypeAndName array_elements_of_tuple_section; block_of_temporary_results.insert(array_elements_of_tuple_section); execute(block_of_temporary_results, ColumnNumbers{i * 2 + 1, 0}, i * 2 + 2); diff --git a/dbms/include/DB/Functions/FunctionsConversion.h b/dbms/include/DB/Functions/FunctionsConversion.h index cc3074c2df4..698e8ac24e2 100644 --- a/dbms/include/DB/Functions/FunctionsConversion.h +++ b/dbms/include/DB/Functions/FunctionsConversion.h @@ -1018,7 +1018,7 @@ public: * Если функция неприменима для данных аргументов - кинуть исключение. * Для неконстантных столбцов arguments[i].column = nullptr. */ - void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments, + void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments, DataTypePtr & out_return_type, std::vector & out_prerequisites) { @@ -1099,7 +1099,7 @@ public: private: template - bool getSizeTyped(const ColumnWithNameAndType & column, size_t & out_size) + bool getSizeTyped(const ColumnWithTypeAndName & column, size_t & out_size) { if (!typeid_cast::Type *>(&*column.type)) return false; @@ -1113,7 +1113,7 @@ private: return true; } - size_t getSize(const ColumnWithNameAndType & column) + size_t getSize(const ColumnWithTypeAndName & column) { size_t res; if (getSizeTyped(column, res) || diff --git a/dbms/include/DB/Functions/FunctionsHashing.h b/dbms/include/DB/Functions/FunctionsHashing.h index 598c1ed84d7..f63afaf808f 100644 --- a/dbms/include/DB/Functions/FunctionsHashing.h +++ b/dbms/include/DB/Functions/FunctionsHashing.h @@ -592,7 +592,7 @@ public: for (size_t i = 0; i < arguments.size(); ++i) { - const ColumnWithNameAndType & column = block.getByPosition(arguments[i]); + const ColumnWithTypeAndName & column = block.getByPosition(arguments[i]); const IDataType * from_type = &*column.type; const IColumn * icolumn = &*column.column; diff --git a/dbms/include/DB/Functions/FunctionsHigherOrder.h b/dbms/include/DB/Functions/FunctionsHigherOrder.h index 29b2728759a..d62fb7340f9 100644 --- a/dbms/include/DB/Functions/FunctionsHigherOrder.h +++ b/dbms/include/DB/Functions/FunctionsHigherOrder.h @@ -586,7 +586,7 @@ public: arguments[0] = new DataTypeExpression(nested_types); } - void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments, + void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments, DataTypePtr & out_return_type, ExpressionActions::Actions & out_prerequisites) { @@ -725,7 +725,7 @@ public: column_first_array = column_array; } - temp_block.insert(ColumnWithNameAndType( + temp_block.insert(ColumnWithTypeAndName( column_array->getDataPtr(), argument_type, argument_name)); @@ -745,7 +745,7 @@ public: if (argument_names.count(name)) continue; - ColumnWithNameAndType replicated_column = block.getByPosition(prerequisites[prerequisite_index]); + ColumnWithTypeAndName replicated_column = block.getByPosition(prerequisites[prerequisite_index]); replicated_column.name = name; replicated_column.column = typeid_cast(*replicated_column.column).getDataPtr(); diff --git a/dbms/include/DB/Functions/FunctionsMiscellaneous.h b/dbms/include/DB/Functions/FunctionsMiscellaneous.h index ae606f53182..3fe496f847a 100644 --- a/dbms/include/DB/Functions/FunctionsMiscellaneous.h +++ b/dbms/include/DB/Functions/FunctionsMiscellaneous.h @@ -453,7 +453,7 @@ public: return name; } - void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments, + void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments, DataTypePtr & out_return_type, ExpressionActions::Actions & out_prerequisites) { diff --git a/dbms/include/DB/Functions/IFunction.h b/dbms/include/DB/Functions/IFunction.h index 431cdfd4dc3..c537e1c5ff2 100644 --- a/dbms/include/DB/Functions/IFunction.h +++ b/dbms/include/DB/Functions/IFunction.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include @@ -54,7 +54,7 @@ public: * Осмысленные типы элементов в out_prerequisites: APPLY_FUNCTION, ADD_COLUMN. */ virtual void getReturnTypeAndPrerequisites( - const ColumnsWithNameAndType & arguments, + const ColumnsWithTypeAndName & arguments, DataTypePtr & out_return_type, std::vector & out_prerequisites) { diff --git a/dbms/include/DB/Interpreters/ExpressionActions.h b/dbms/include/DB/Interpreters/ExpressionActions.h index 31d32e6856b..b4dedade097 100644 --- a/dbms/include/DB/Interpreters/ExpressionActions.h +++ b/dbms/include/DB/Interpreters/ExpressionActions.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -77,7 +77,7 @@ public: /// Если result_name_ == "", в качестве имени используется "имя_функции(аргументы через запятую)". static ExpressionAction applyFunction(FunctionPtr function_, const std::vector & argument_names_, std::string result_name_ = ""); - static ExpressionAction addColumn(ColumnWithNameAndType added_column_) + static ExpressionAction addColumn(ColumnWithTypeAndName added_column_) { ExpressionAction a; a.type = ADD_COLUMN; @@ -168,11 +168,11 @@ public: : input_columns(input_columns_), settings(settings_) { for (const auto & input_elem : input_columns) - sample_block.insert(ColumnWithNameAndType(nullptr, input_elem.type, input_elem.name)); + sample_block.insert(ColumnWithTypeAndName(nullptr, input_elem.type, input_elem.name)); } /// Для константных столбцов в input_columns_ могут содержаться сами столбцы. - ExpressionActions(const ColumnsWithNameAndType & input_columns_, const Settings & settings_) + ExpressionActions(const ColumnsWithTypeAndName & input_columns_, const Settings & settings_) : settings(settings_) { for (const auto & input_elem : input_columns_) @@ -185,7 +185,7 @@ public: /// Добавить входной столбец. /// Название столбца не должно совпадать с названиями промежуточных столбцов, возникающих при вычислении выражения. /// В выражении не должно быть действий PROJECT. - void addInput(const ColumnWithNameAndType & column); + void addInput(const ColumnWithTypeAndName & column); void addInput(const NameAndTypePair & column); void add(const ExpressionAction & action); diff --git a/dbms/include/DB/Interpreters/InterpreterDescribeQuery.h b/dbms/include/DB/Interpreters/InterpreterDescribeQuery.h index 81eb95abb08..a24bc0a099b 100644 --- a/dbms/include/DB/Interpreters/InterpreterDescribeQuery.h +++ b/dbms/include/DB/Interpreters/InterpreterDescribeQuery.h @@ -44,7 +44,7 @@ private: { Block block; - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "name"; col.type = new DataTypeString; col.column = col.type->createColumn(); @@ -78,10 +78,10 @@ private: column_defaults = table->column_defaults; } - ColumnWithNameAndType name_column{new ColumnString, new DataTypeString, "name"}; - ColumnWithNameAndType type_column{new ColumnString, new DataTypeString, "type" }; - ColumnWithNameAndType default_type_column{new ColumnString, new DataTypeString, "default_type" }; - ColumnWithNameAndType default_expression_column{new ColumnString, new DataTypeString, "default_expression" };; + ColumnWithTypeAndName name_column{new ColumnString, new DataTypeString, "name"}; + ColumnWithTypeAndName type_column{new ColumnString, new DataTypeString, "type" }; + ColumnWithTypeAndName default_type_column{new ColumnString, new DataTypeString, "default_type" }; + ColumnWithTypeAndName default_expression_column{new ColumnString, new DataTypeString, "default_expression" };; for (const auto column : columns) { diff --git a/dbms/include/DB/Interpreters/InterpreterExistsQuery.h b/dbms/include/DB/Interpreters/InterpreterExistsQuery.h index 4b7d8247529..b4f7636232c 100644 --- a/dbms/include/DB/Interpreters/InterpreterExistsQuery.h +++ b/dbms/include/DB/Interpreters/InterpreterExistsQuery.h @@ -39,7 +39,7 @@ private: Block getSampleBlock() { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "result"; col.type = new DataTypeUInt8; col.column = col.type->createColumn(); @@ -56,7 +56,7 @@ private: bool res = context.isTableExist(ast.database, ast.table); - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "result"; col.type = new DataTypeUInt8; col.column = new ColumnConstUInt8(1, res); diff --git a/dbms/include/DB/Interpreters/InterpreterShowCreateQuery.h b/dbms/include/DB/Interpreters/InterpreterShowCreateQuery.h index a2aebb46d52..43c4eeb0ad4 100644 --- a/dbms/include/DB/Interpreters/InterpreterShowCreateQuery.h +++ b/dbms/include/DB/Interpreters/InterpreterShowCreateQuery.h @@ -40,7 +40,7 @@ private: Block getSampleBlock() { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "statement"; col.type = new DataTypeString; col.column = col.type->createColumn(); @@ -59,7 +59,7 @@ private: formatAST(*context.getCreateQuery(ast.database, ast.table), stream, 0, false, true); String res = stream.str(); - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "statement"; col.type = new DataTypeString; col.column = new ColumnConstString(1, res); diff --git a/dbms/include/DB/Storages/MergeTree/MergeTreeBlockInputStream.h b/dbms/include/DB/Storages/MergeTree/MergeTreeBlockInputStream.h index 2d2b3230fc9..086e79c0c81 100644 --- a/dbms/include/DB/Storages/MergeTree/MergeTreeBlockInputStream.h +++ b/dbms/include/DB/Storages/MergeTree/MergeTreeBlockInputStream.h @@ -305,7 +305,7 @@ protected: size_t rows = 0; for (size_t i = 0; i < res.columns(); ++i) { - ColumnWithNameAndType & column = res.getByPosition(i); + ColumnWithTypeAndName & column = res.getByPosition(i); if (column.name == prewhere_column && res.columns() > 1) continue; column.column = column.column->filter(column_name_set.count(column.name) ? post_filter : pre_filter); diff --git a/dbms/include/DB/Storages/MergeTree/MergeTreeReader.h b/dbms/include/DB/Storages/MergeTree/MergeTreeReader.h index e5683f4caeb..e52d2d6a725 100644 --- a/dbms/include/DB/Storages/MergeTree/MergeTreeReader.h +++ b/dbms/include/DB/Storages/MergeTree/MergeTreeReader.h @@ -92,7 +92,7 @@ public: /// Все столбцы уже есть в блоке. Будем добавлять значения в конец. bool append = res.has(it.name); - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.name = it.name; column.type = it.type; if (append) @@ -487,7 +487,7 @@ private: OffsetColumns offset_columns; for (size_t i = 0; i < res.columns(); ++i) { - const ColumnWithNameAndType & column = res.getByPosition(i); + const ColumnWithTypeAndName & column = res.getByPosition(i); if (const ColumnArray * array = typeid_cast(&*column.column)) { String offsets_name = DataTypeNested::extractNestedTableName(column.name); @@ -514,7 +514,7 @@ private: continue; } - ColumnWithNameAndType column_to_add; + ColumnWithTypeAndName column_to_add; column_to_add.name = requested_column.name; column_to_add.type = requested_column.type; diff --git a/dbms/include/DB/Storages/MergeTree/MergedBlockOutputStream.h b/dbms/include/DB/Storages/MergeTree/MergedBlockOutputStream.h index 2e657670dbd..aebdaee0143 100644 --- a/dbms/include/DB/Storages/MergeTree/MergedBlockOutputStream.h +++ b/dbms/include/DB/Storages/MergeTree/MergedBlockOutputStream.h @@ -283,7 +283,7 @@ public: size_t rows = block.rows(); /// Сначала пишем индекс. Индекс содержит значение Primary Key для каждой index_granularity строки. - typedef std::vector PrimaryColumns; + typedef std::vector PrimaryColumns; PrimaryColumns primary_columns; for (const auto & descr : storage.getSortDescription()) @@ -311,7 +311,7 @@ public: /// Теперь пишем данные. for (const auto & it : columns_list) { - const ColumnWithNameAndType & column = block.getByName(it.name); + const ColumnWithTypeAndName & column = block.getByName(it.name); writeData(column.name, *column.type, *column.column, offset_columns); } @@ -435,7 +435,7 @@ public: OffsetColumns offset_columns; for (size_t i = 0; i < block.columns(); ++i) { - const ColumnWithNameAndType & column = block.getByPosition(i); + const ColumnWithTypeAndName & column = block.getByPosition(i); writeData(column.name, *column.type, *column.column, offset_columns); } diff --git a/dbms/src/Core/Block.cpp b/dbms/src/Core/Block.cpp index d551715c42f..7c827846980 100644 --- a/dbms/src/Core/Block.cpp +++ b/dbms/src/Core/Block.cpp @@ -51,7 +51,7 @@ void Block::addDefaults(const NamesAndTypesList & required_columns) if (has(requested_column.name)) continue; - ColumnWithNameAndType column_to_add; + ColumnWithTypeAndName column_to_add; column_to_add.name = requested_column.name; column_to_add.type = requested_column.type; @@ -101,7 +101,7 @@ Block & Block::operator= (const Block & other) return *this; } -void Block::insert(size_t position, const ColumnWithNameAndType & elem) +void Block::insert(size_t position, const ColumnWithTypeAndName & elem) { if (position > index_by_position.size()) throw Exception("Position out of bound in Block::insert(), max position = " @@ -124,7 +124,7 @@ void Block::insert(size_t position, const ColumnWithNameAndType & elem) } -void Block::insert(const ColumnWithNameAndType & elem) +void Block::insert(const ColumnWithTypeAndName & elem) { Container_t::iterator it = data.insert(data.end(), elem); index_by_name[elem.name] = it; @@ -132,7 +132,7 @@ void Block::insert(const ColumnWithNameAndType & elem) } -void Block::insertUnique(const ColumnWithNameAndType & elem) +void Block::insertUnique(const ColumnWithTypeAndName & elem) { if (index_by_name.end() == index_by_name.find(elem.name)) insert(elem); @@ -175,7 +175,7 @@ void Block::erase(const String & name) } -ColumnWithNameAndType & Block::getByPosition(size_t position) +ColumnWithTypeAndName & Block::getByPosition(size_t position) { if (position >= index_by_position.size()) throw Exception("Position " + toString(position) @@ -187,7 +187,7 @@ ColumnWithNameAndType & Block::getByPosition(size_t position) } -const ColumnWithNameAndType & Block::getByPosition(size_t position) const +const ColumnWithTypeAndName & Block::getByPosition(size_t position) const { if (position >= index_by_position.size()) throw Exception("Position " + toString(position) @@ -199,7 +199,7 @@ const ColumnWithNameAndType & Block::getByPosition(size_t position) const } -ColumnWithNameAndType & Block::getByName(const std::string & name) +ColumnWithTypeAndName & Block::getByName(const std::string & name) { IndexByName_t::const_iterator it = index_by_name.find(name); if (index_by_name.end() == it) @@ -210,7 +210,7 @@ ColumnWithNameAndType & Block::getByName(const std::string & name) } -const ColumnWithNameAndType & Block::getByName(const std::string & name) const +const ColumnWithTypeAndName & Block::getByName(const std::string & name) const { IndexByName_t::const_iterator it = index_by_name.find(name); if (index_by_name.end() == it) @@ -330,9 +330,9 @@ Block Block::sortColumns() const } -ColumnsWithNameAndType Block::getColumns() const +ColumnsWithTypeAndName Block::getColumns() const { - return ColumnsWithNameAndType(data.begin(), data.end()); + return ColumnsWithTypeAndName(data.begin(), data.end()); } diff --git a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp index 5f25260cc42..2e696f5a81b 100644 --- a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp @@ -37,7 +37,7 @@ Block AggregatingSortedBlockInputStream::readImpl() /// Заполним номера столбцов, которые нужно доагрегировать. for (size_t i = 0; i < num_columns; ++i) { - ColumnWithNameAndType & column = merged_block.getByPosition(i); + ColumnWithTypeAndName & column = merged_block.getByPosition(i); /// Оставляем только состояния аггрегатных функций. if (strncmp(column.type->getName().data(), "AggregateFunction", strlen("AggregateFunction")) != 0) diff --git a/dbms/src/DataStreams/FilterBlockInputStream.cpp b/dbms/src/DataStreams/FilterBlockInputStream.cpp index 75de7654b96..ed31467d8a6 100644 --- a/dbms/src/DataStreams/FilterBlockInputStream.cpp +++ b/dbms/src/DataStreams/FilterBlockInputStream.cpp @@ -75,7 +75,7 @@ Block FilterBlockInputStream::readImpl() size_t filtered_rows = 0; if (first_non_constant_column != static_cast(filter_column)) { - ColumnWithNameAndType & current_column = res.getByPosition(first_non_constant_column); + ColumnWithTypeAndName & current_column = res.getByPosition(first_non_constant_column); current_column.column = current_column.column->filter(filter); filtered_rows = current_column.column->size(); } @@ -100,7 +100,7 @@ Block FilterBlockInputStream::readImpl() /// Фильтруем остальные столбцы. for (size_t i = 0; i < columns; ++i) { - ColumnWithNameAndType & current_column = res.getByPosition(i); + ColumnWithTypeAndName & current_column = res.getByPosition(i); if (i == static_cast(filter_column)) { diff --git a/dbms/src/DataStreams/JSONCompactRowOutputStream.cpp b/dbms/src/DataStreams/JSONCompactRowOutputStream.cpp index 1555862226a..ee1f7560d4b 100644 --- a/dbms/src/DataStreams/JSONCompactRowOutputStream.cpp +++ b/dbms/src/DataStreams/JSONCompactRowOutputStream.cpp @@ -58,7 +58,7 @@ void JSONCompactRowOutputStream::writeTotals() if (i != 0) writeChar(',', *ostr); - const ColumnWithNameAndType & column = totals.getByPosition(i); + const ColumnWithTypeAndName & column = totals.getByPosition(i); column.type->serializeTextJSON((*column.column)[0], *ostr); } @@ -79,7 +79,7 @@ static void writeExtremesElement(const char * title, const Block & extremes, siz if (i != 0) writeChar(',', ostr); - const ColumnWithNameAndType & column = extremes.getByPosition(i); + const ColumnWithTypeAndName & column = extremes.getByPosition(i); column.type->serializeTextJSON((*column.column)[row_num], ostr); } diff --git a/dbms/src/DataStreams/JSONRowOutputStream.cpp b/dbms/src/DataStreams/JSONRowOutputStream.cpp index afcff6956f8..f6a4080ea4e 100644 --- a/dbms/src/DataStreams/JSONRowOutputStream.cpp +++ b/dbms/src/DataStreams/JSONRowOutputStream.cpp @@ -139,7 +139,7 @@ void JSONRowOutputStream::writeTotals() size_t totals_columns = totals.columns(); for (size_t i = 0; i < totals_columns; ++i) { - const ColumnWithNameAndType & column = totals.getByPosition(i); + const ColumnWithTypeAndName & column = totals.getByPosition(i); if (i != 0) writeCString(",\n", *ostr); @@ -166,7 +166,7 @@ static void writeExtremesElement(const char * title, const Block & extremes, siz size_t extremes_columns = extremes.columns(); for (size_t i = 0; i < extremes_columns; ++i) { - const ColumnWithNameAndType & column = extremes.getByPosition(i); + const ColumnWithTypeAndName & column = extremes.getByPosition(i); if (i != 0) writeCString(",\n", ostr); diff --git a/dbms/src/DataStreams/NativeBlockInputStream.cpp b/dbms/src/DataStreams/NativeBlockInputStream.cpp index b9fa55aa449..54ca62c253c 100644 --- a/dbms/src/DataStreams/NativeBlockInputStream.cpp +++ b/dbms/src/DataStreams/NativeBlockInputStream.cpp @@ -62,7 +62,7 @@ Block NativeBlockInputStream::readImpl() for (size_t i = 0; i < columns; ++i) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; /// Имя readStringBinary(column.name, istr); diff --git a/dbms/src/DataStreams/NativeBlockOutputStream.cpp b/dbms/src/DataStreams/NativeBlockOutputStream.cpp index f2d61dfa158..a85a10a5909 100644 --- a/dbms/src/DataStreams/NativeBlockOutputStream.cpp +++ b/dbms/src/DataStreams/NativeBlockOutputStream.cpp @@ -76,7 +76,7 @@ void NativeBlockOutputStream::write(const Block & block) for (size_t i = 0; i < columns; ++i) { - const ColumnWithNameAndType & column = block.getByPosition(i); + const ColumnWithTypeAndName & column = block.getByPosition(i); /// Имя writeStringBinary(column.name, ostr); diff --git a/dbms/src/DataStreams/PrettyBlockOutputStream.cpp b/dbms/src/DataStreams/PrettyBlockOutputStream.cpp index bbcbac06065..d972682523f 100644 --- a/dbms/src/DataStreams/PrettyBlockOutputStream.cpp +++ b/dbms/src/DataStreams/PrettyBlockOutputStream.cpp @@ -32,7 +32,7 @@ void PrettyBlockOutputStream::calculateWidths(Block & block, Widths_t & max_widt /// Вычислим ширину всех значений for (size_t i = 0; i < columns; ++i) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.type = visible_width_type; column.name = "visibleWidth(" + block.getByPosition(i).name + ")"; @@ -137,7 +137,7 @@ void PrettyBlockOutputStream::write(const Block & block_) if (i != 0) writeCString(" ┃ ", ostr); - const ColumnWithNameAndType & col = block.getByPosition(i); + const ColumnWithTypeAndName & col = block.getByPosition(i); if (!no_escapes) writeCString("\033[1m", ostr); @@ -176,7 +176,7 @@ void PrettyBlockOutputStream::write(const Block & block_) if (j != 0) writeCString(" │ ", ostr); - const ColumnWithNameAndType & col = block.getByPosition(j); + const ColumnWithTypeAndName & col = block.getByPosition(j); if (col.type->isNumeric()) { diff --git a/dbms/src/DataStreams/PrettyCompactBlockOutputStream.cpp b/dbms/src/DataStreams/PrettyCompactBlockOutputStream.cpp index 530a1ef12f2..7eae58e2328 100644 --- a/dbms/src/DataStreams/PrettyCompactBlockOutputStream.cpp +++ b/dbms/src/DataStreams/PrettyCompactBlockOutputStream.cpp @@ -21,7 +21,7 @@ void PrettyCompactBlockOutputStream::writeHeader( if (i != 0) writeCString("─┬─", ostr); - const ColumnWithNameAndType & col = block.getByPosition(i); + const ColumnWithTypeAndName & col = block.getByPosition(i); if (col.type->isNumeric()) { @@ -83,7 +83,7 @@ void PrettyCompactBlockOutputStream::writeRow( if (j != 0) writeCString(" │ ", ostr); - const ColumnWithNameAndType & col = block.getByPosition(j); + const ColumnWithTypeAndName & col = block.getByPosition(j); if (col.type->isNumeric()) { diff --git a/dbms/src/DataStreams/PrettySpaceBlockOutputStream.cpp b/dbms/src/DataStreams/PrettySpaceBlockOutputStream.cpp index 8c92367eebd..86900d3ff2f 100644 --- a/dbms/src/DataStreams/PrettySpaceBlockOutputStream.cpp +++ b/dbms/src/DataStreams/PrettySpaceBlockOutputStream.cpp @@ -40,7 +40,7 @@ void PrettySpaceBlockOutputStream::write(const Block & block_) if (i != 0) writeCString(" ", ostr); - const ColumnWithNameAndType & col = block.getByPosition(i); + const ColumnWithTypeAndName & col = block.getByPosition(i); if (col.type->isNumeric()) { @@ -74,7 +74,7 @@ void PrettySpaceBlockOutputStream::write(const Block & block_) if (j != 0) writeCString(" ", ostr); - const ColumnWithNameAndType & col = block.getByPosition(j); + const ColumnWithTypeAndName & col = block.getByPosition(j); if (col.type->isNumeric()) { diff --git a/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp b/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp index 0a41e5ffd15..fb50f9f672a 100644 --- a/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp @@ -63,7 +63,7 @@ Block SummingSortedBlockInputStream::readImpl() */ for (size_t i = 0; i < num_columns; ++i) { - ColumnWithNameAndType & column = merged_block.getByPosition(i); + ColumnWithTypeAndName & column = merged_block.getByPosition(i); /// Discover nested Maps and find columns for summation if (const auto array_type = typeid_cast(column.type.get())) diff --git a/dbms/src/DataStreams/TabSeparatedBlockOutputStream.cpp b/dbms/src/DataStreams/TabSeparatedBlockOutputStream.cpp index 142f8dc9e35..0d9869af0c9 100644 --- a/dbms/src/DataStreams/TabSeparatedBlockOutputStream.cpp +++ b/dbms/src/DataStreams/TabSeparatedBlockOutputStream.cpp @@ -9,7 +9,7 @@ void TabSeparatedBlockOutputStream::write(const Block & block) size_t columns = block.columns(); for (size_t i = 0; i < columns; ++i) { - const ColumnWithNameAndType & col = block.getByPosition(i); + const ColumnWithTypeAndName & col = block.getByPosition(i); size_t rows = block.rows(); for (size_t j = 0; j < rows; ++j) diff --git a/dbms/src/DataStreams/TotalsHavingBlockInputStream.cpp b/dbms/src/DataStreams/TotalsHavingBlockInputStream.cpp index 558e0ca6571..1967d117bb1 100644 --- a/dbms/src/DataStreams/TotalsHavingBlockInputStream.cpp +++ b/dbms/src/DataStreams/TotalsHavingBlockInputStream.cpp @@ -9,7 +9,7 @@ static void finalize(Block & block) { for (size_t i = 0; i < block.columns(); ++i) { - ColumnWithNameAndType & current = block.getByPosition(i); + ColumnWithTypeAndName & current = block.getByPosition(i); ColumnAggregateFunction * unfinalized_column = typeid_cast(&*current.column); if (unfinalized_column) { @@ -106,7 +106,7 @@ Block TotalsHavingBlockInputStream::readImpl() for (size_t i = 0; i < columns; ++i) { - ColumnWithNameAndType & current_column = finalized.getByPosition(i); + ColumnWithTypeAndName & current_column = finalized.getByPosition(i); current_column.column = current_column.column->filter(filter); if (current_column.column->empty()) { @@ -134,7 +134,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co for (size_t i = 0; i < block.columns(); ++i) { - const ColumnWithNameAndType & current = block.getByPosition(i); + const ColumnWithTypeAndName & current = block.getByPosition(i); const ColumnAggregateFunction * column = typeid_cast(&*current.column); if (!column) @@ -143,7 +143,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co { ColumnPtr new_column = current.type->createColumn(); new_column->insertDefault(); - totals.insert(ColumnWithNameAndType(new_column, current.type, current.name)); + totals.insert(ColumnWithTypeAndName(new_column, current.type, current.name)); } continue; } @@ -156,7 +156,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co { function = column->getAggregateFunction(); target = new ColumnAggregateFunction(column->getAggregateFunction(), Arenas(1, arena)); - totals.insert(ColumnWithNameAndType(target, current.type, current.name)); + totals.insert(ColumnWithTypeAndName(target, current.type, current.name)); data = arena->alloc(function->sizeOfData()); function->create(data); diff --git a/dbms/src/DataStreams/tests/aggregating_stream.cpp b/dbms/src/DataStreams/tests/aggregating_stream.cpp index 323b34e7690..7deea2865ab 100644 --- a/dbms/src/DataStreams/tests/aggregating_stream.cpp +++ b/dbms/src/DataStreams/tests/aggregating_stream.cpp @@ -31,7 +31,7 @@ int main(int argc, char ** argv) Block block; - ColumnWithNameAndType column_x; + ColumnWithTypeAndName column_x; column_x.name = "x"; column_x.type = new DataTypeInt16; ColumnInt16 * x = new ColumnInt16; @@ -46,7 +46,7 @@ int main(int argc, char ** argv) const char * strings[] = {"abc", "def", "abcd", "defg", "ac"}; - ColumnWithNameAndType column_s1; + ColumnWithTypeAndName column_s1; column_s1.name = "s1"; column_s1.type = new DataTypeString; column_s1.column = new ColumnString; @@ -56,7 +56,7 @@ int main(int argc, char ** argv) block.insert(column_s1); - ColumnWithNameAndType column_s2; + ColumnWithTypeAndName column_s2; column_s2.name = "s2"; column_s2.type = new DataTypeString; column_s2.column = new ColumnString; @@ -86,7 +86,7 @@ int main(int argc, char ** argv) Block sample; for (DataTypes::const_iterator it = result_types->begin(); it != result_types->end(); ++it) { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.type = *it; sample.insert(col); } diff --git a/dbms/src/DataStreams/tests/block_row_transforms.cpp b/dbms/src/DataStreams/tests/block_row_transforms.cpp index 07ba03eaa9c..bcc0624811f 100644 --- a/dbms/src/DataStreams/tests/block_row_transforms.cpp +++ b/dbms/src/DataStreams/tests/block_row_transforms.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -28,13 +28,13 @@ int main(int argc, char ** argv) { DB::Block sample; - DB::ColumnWithNameAndType col1; + DB::ColumnWithTypeAndName col1; col1.name = "col1"; col1.type = new DB::DataTypeUInt64; col1.column = col1.type->createColumn(); sample.insert(col1); - DB::ColumnWithNameAndType col2; + DB::ColumnWithTypeAndName col2; col2.name = "col2"; col2.type = new DB::DataTypeString; col2.column = col2.type->createColumn(); diff --git a/dbms/src/DataStreams/tests/block_tab_separated_streams.cpp b/dbms/src/DataStreams/tests/block_tab_separated_streams.cpp index 981c3c2178e..fb8d19c6e68 100644 --- a/dbms/src/DataStreams/tests/block_tab_separated_streams.cpp +++ b/dbms/src/DataStreams/tests/block_tab_separated_streams.cpp @@ -98,7 +98,7 @@ int main(int argc, char ** argv) Block sample; for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it) { - ColumnWithNameAndType elem; + ColumnWithTypeAndName elem; elem.name = it->name; elem.type = it->type; elem.column = elem.type->createColumn(); diff --git a/dbms/src/DataStreams/tests/collapsing_sorted_stream.cpp b/dbms/src/DataStreams/tests/collapsing_sorted_stream.cpp index 3670878ffba..2988b1c04d4 100644 --- a/dbms/src/DataStreams/tests/collapsing_sorted_stream.cpp +++ b/dbms/src/DataStreams/tests/collapsing_sorted_stream.cpp @@ -32,7 +32,7 @@ int main(int argc, char ** argv) Block block1; { - ColumnWithNameAndType column1; + ColumnWithTypeAndName column1; column1.name = "Sign"; column1.type = new DataTypeInt8; column1.column = new ColumnInt8; @@ -40,7 +40,7 @@ int main(int argc, char ** argv) column1.column->insert(DB::Int64(-1)); block1.insert(column1); - ColumnWithNameAndType column2; + ColumnWithTypeAndName column2; column2.name = "CounterID"; column2.type = new DataTypeUInt32; column2.column = new ColumnUInt32; @@ -52,7 +52,7 @@ int main(int argc, char ** argv) Block block2; { - ColumnWithNameAndType column1; + ColumnWithTypeAndName column1; column1.name = "Sign"; column1.type = new DataTypeInt8; column1.column = new ColumnInt8; @@ -60,7 +60,7 @@ int main(int argc, char ** argv) column1.column->insert(DB::Int64(1)); block2.insert(column1); - ColumnWithNameAndType column2; + ColumnWithTypeAndName column2; column2.name = "CounterID"; column2.type = new DataTypeUInt32; column2.column = new ColumnUInt32; diff --git a/dbms/src/DataStreams/tests/json_streams.cpp b/dbms/src/DataStreams/tests/json_streams.cpp index 8a21422969a..e11db259721 100644 --- a/dbms/src/DataStreams/tests/json_streams.cpp +++ b/dbms/src/DataStreams/tests/json_streams.cpp @@ -51,7 +51,7 @@ int main(int argc, char ** argv) Block sample; for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it) { - ColumnWithNameAndType elem; + ColumnWithTypeAndName elem; elem.name = it->name; elem.type = it->type; elem.column = elem.type->createColumn(); diff --git a/dbms/src/DataStreams/tests/sorting_stream.cpp b/dbms/src/DataStreams/tests/sorting_stream.cpp index b503ae6ec7d..15d24f7d6f8 100644 --- a/dbms/src/DataStreams/tests/sorting_stream.cpp +++ b/dbms/src/DataStreams/tests/sorting_stream.cpp @@ -136,7 +136,7 @@ int main(int argc, char ** argv) Block sample; for (DataTypes::const_iterator it = result_types->begin(); it != result_types->end(); ++it) { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.type = *it; sample.insert(col); } diff --git a/dbms/src/DataStreams/tests/tab_separated_streams.cpp b/dbms/src/DataStreams/tests/tab_separated_streams.cpp index db3a3ac2bee..4093443ffd8 100644 --- a/dbms/src/DataStreams/tests/tab_separated_streams.cpp +++ b/dbms/src/DataStreams/tests/tab_separated_streams.cpp @@ -21,12 +21,12 @@ int main(int argc, char ** argv) { DB::Block sample; { - DB::ColumnWithNameAndType col; + DB::ColumnWithTypeAndName col; col.type = new DB::DataTypeUInt64; sample.insert(col); } { - DB::ColumnWithNameAndType col; + DB::ColumnWithTypeAndName col; col.type = new DB::DataTypeString; sample.insert(col); } diff --git a/dbms/src/Functions/FunctionsMiscellaneous.cpp b/dbms/src/Functions/FunctionsMiscellaneous.cpp index 0f7ad1114b6..fd8d18b4531 100644 --- a/dbms/src/Functions/FunctionsMiscellaneous.cpp +++ b/dbms/src/Functions/FunctionsMiscellaneous.cpp @@ -189,12 +189,12 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument { /// Вычисляем видимую ширину для значений массива. Block nested_block; - ColumnWithNameAndType nested_values; + ColumnWithTypeAndName nested_values; nested_values.type = typeid_cast(*type).getNestedType(); nested_values.column = col->getDataPtr(); nested_block.insert(nested_values); - ColumnWithNameAndType nested_result; + ColumnWithTypeAndName nested_result; nested_result.type = new DataTypeUInt64; nested_block.insert(nested_result); @@ -253,7 +253,7 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument * x1, x2, x3... , width1, width2, width1 + width2, width3, width1 + width2 + width3, ... */ - ColumnWithNameAndType nested_result; + ColumnWithTypeAndName nested_result; nested_result.type = new DataTypeUInt64; nested_block.insert(nested_result); @@ -262,7 +262,7 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument if (i != 0) { - ColumnWithNameAndType plus_result; + ColumnWithTypeAndName plus_result; plus_result.type = new DataTypeUInt64; nested_block.insert(plus_result); diff --git a/dbms/src/Functions/tests/functions_arithmetic.cpp b/dbms/src/Functions/tests/functions_arithmetic.cpp index 4a7a05a23e3..4682197531f 100644 --- a/dbms/src/Functions/tests/functions_arithmetic.cpp +++ b/dbms/src/Functions/tests/functions_arithmetic.cpp @@ -12,14 +12,14 @@ int main(int argc, char ** argv) { size_t n = atoi(argv[1]); - DB::ColumnWithNameAndType descr1; + DB::ColumnWithTypeAndName descr1; DB::ColumnUInt8 * col1 = new DB::ColumnUInt8; descr1.type = new DB::DataTypeUInt8; descr1.column = col1; descr1.name = "x"; col1->getData().resize(n); - DB::ColumnWithNameAndType descr2; + DB::ColumnWithTypeAndName descr2; DB::ColumnInt16 * col2 = new DB::ColumnInt16; descr2.type = new DB::DataTypeInt16; descr2.column = col2; @@ -49,7 +49,7 @@ int main(int argc, char ** argv) DB::DataTypePtr res_type = f.getReturnType(arg_types); - DB::ColumnWithNameAndType descr_res; + DB::ColumnWithTypeAndName descr_res; descr_res.type = res_type; descr_res.name = "z"; diff --git a/dbms/src/Functions/tests/logical_functions_performance.cpp b/dbms/src/Functions/tests/logical_functions_performance.cpp index 243a2322539..cfe5cbe614f 100644 --- a/dbms/src/Functions/tests/logical_functions_performance.cpp +++ b/dbms/src/Functions/tests/logical_functions_performance.cpp @@ -337,7 +337,7 @@ int main(int argc, char ** argv) for (size_t i = 0; i < columns; ++i) { ColumnVector * column = new ColumnVector(block_size); - blocks[b].insert(ColumnWithNameAndType(column, new DataTypeUInt8, "v" + toString(i))); + blocks[b].insert(ColumnWithTypeAndName(column, new DataTypeUInt8, "v" + toString(i))); ColumnVector::Container_t & vec = column->getData(); vec.resize(block_size); @@ -351,7 +351,7 @@ int main(int argc, char ** argv) for (size_t b = 0; b < block_count; ++b) { ColumnVector * result_column = new ColumnVector; - blocks[b].insert(ColumnWithNameAndType(result_column, new DataTypeUInt8, "x")); + blocks[b].insert(ColumnWithTypeAndName(result_column, new DataTypeUInt8, "x")); result_column->getData().resize(block_size); } diff --git a/dbms/src/Interpreters/Aggregator.cpp b/dbms/src/Interpreters/Aggregator.cpp index 100b846d5fb..74bffca822a 100644 --- a/dbms/src/Interpreters/Aggregator.cpp +++ b/dbms/src/Interpreters/Aggregator.cpp @@ -121,7 +121,7 @@ void Aggregator::initialize(Block & block) for (size_t i = 0; i < aggregates_size; ++i) { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = aggregates[i].column_name; size_t arguments_size = aggregates[i].arguments.size(); @@ -848,7 +848,7 @@ Block Aggregator::prepareBlockAndFill( } else { - ColumnWithNameAndType & column = res.getByPosition(i + keys_size); + ColumnWithTypeAndName & column = res.getByPosition(i + keys_size); column.type = aggregate_functions[i]->getReturnType(); column.column = column.type->createColumn(); column.column->reserve(rows); diff --git a/dbms/src/Interpreters/ExpressionActions.cpp b/dbms/src/Interpreters/ExpressionActions.cpp index c6b78cfbc5a..a227bb1c713 100644 --- a/dbms/src/Interpreters/ExpressionActions.cpp +++ b/dbms/src/Interpreters/ExpressionActions.cpp @@ -61,7 +61,7 @@ ExpressionActions::Actions ExpressionAction::getPrerequisites(Block & sample_blo if (sample_block.has(result_name)) throw Exception("Column '" + result_name + "' already exists", ErrorCodes::DUPLICATE_COLUMN); - ColumnsWithNameAndType arguments(argument_names.size()); + ColumnsWithTypeAndName arguments(argument_names.size()); for (size_t i = 0; i < argument_names.size(); ++i) { if (!sample_block.has(argument_names[i])) @@ -126,7 +126,7 @@ void ExpressionAction::prepare(Block & sample_block) { size_t result_position = sample_block.columns(); - ColumnWithNameAndType new_column; + ColumnWithTypeAndName new_column; new_column.name = result_name; new_column.type = result_type; sample_block.insert(new_column); @@ -134,13 +134,13 @@ void ExpressionAction::prepare(Block & sample_block) function->execute(sample_block, arguments, prerequisites, result_position); /// Если получилась не константа, на всякий случай будем считать результат неизвестным. - ColumnWithNameAndType & col = sample_block.getByPosition(result_position); + ColumnWithTypeAndName & col = sample_block.getByPosition(result_position); if (!col.column->isConst()) col.column = nullptr; } else { - sample_block.insert(ColumnWithNameAndType(nullptr, result_type, result_name)); + sample_block.insert(ColumnWithTypeAndName(nullptr, result_type, result_name)); } break; @@ -150,7 +150,7 @@ void ExpressionAction::prepare(Block & sample_block) { for (NameSet::iterator it = array_joined_columns.begin(); it != array_joined_columns.end(); ++it) { - ColumnWithNameAndType & current = sample_block.getByName(*it); + ColumnWithTypeAndName & current = sample_block.getByName(*it); const DataTypeArray * array_type = typeid_cast(&*current.type); if (!array_type) throw Exception("ARRAY JOIN requires array argument", ErrorCodes::TYPE_MISMATCH); @@ -164,7 +164,7 @@ void ExpressionAction::prepare(Block & sample_block) case JOIN: { for (const auto & col : columns_added_by_join) - sample_block.insert(ColumnWithNameAndType(nullptr, col.type, col.name)); + sample_block.insert(ColumnWithTypeAndName(nullptr, col.type, col.name)); break; } @@ -177,7 +177,7 @@ void ExpressionAction::prepare(Block & sample_block) { const std::string & name = projection[i].first; const std::string & alias = projection[i].second; - ColumnWithNameAndType column = sample_block.getByName(name); + ColumnWithTypeAndName column = sample_block.getByName(name); if (alias != "") column.name = alias; new_block.insert(column); @@ -198,14 +198,14 @@ void ExpressionAction::prepare(Block & sample_block) if (sample_block.has(result_name)) throw Exception("Column '" + result_name + "' already exists", ErrorCodes::DUPLICATE_COLUMN); - sample_block.insert(ColumnWithNameAndType(added_column, result_type, result_name)); + sample_block.insert(ColumnWithTypeAndName(added_column, result_type, result_name)); break; } case COPY_COLUMN: { result_type = sample_block.getByName(source_name).type; - sample_block.insert(ColumnWithNameAndType(sample_block.getByName(source_name).column, result_type, result_name)); + sample_block.insert(ColumnWithTypeAndName(sample_block.getByName(source_name).column, result_type, result_name)); break; } @@ -246,7 +246,7 @@ void ExpressionAction::execute(Block & block) const prerequisites[i] = block.getPositionByName(prerequisite_names[i]); } - ColumnWithNameAndType new_column; + ColumnWithTypeAndName new_column; new_column.name = result_name; new_column.type = result_type; block.insert(new_column); @@ -271,7 +271,7 @@ void ExpressionAction::execute(Block & block) const size_t columns = block.columns(); for (size_t i = 0; i < columns; ++i) { - ColumnWithNameAndType & current = block.getByPosition(i); + ColumnWithTypeAndName & current = block.getByPosition(i); if (array_joined_columns.count(current.name)) { @@ -312,7 +312,7 @@ void ExpressionAction::execute(Block & block) const { const std::string & name = projection[i].first; const std::string & alias = projection[i].second; - ColumnWithNameAndType column = block.getByName(name); + ColumnWithTypeAndName column = block.getByName(name); if (alias != "") column.name = alias; new_block.insert(column); @@ -328,11 +328,11 @@ void ExpressionAction::execute(Block & block) const break; case ADD_COLUMN: - block.insert(ColumnWithNameAndType(added_column->cloneResized(block.rowsInFirstColumn()), result_type, result_name)); + block.insert(ColumnWithTypeAndName(added_column->cloneResized(block.rowsInFirstColumn()), result_type, result_name)); break; case COPY_COLUMN: - block.insert(ColumnWithNameAndType(block.getByName(source_name).column, result_type, result_name)); + block.insert(ColumnWithTypeAndName(block.getByName(source_name).column, result_type, result_name)); break; default: @@ -446,7 +446,7 @@ void ExpressionActions::checkLimits(Block & block) const } } -void ExpressionActions::addInput(const ColumnWithNameAndType & column) +void ExpressionActions::addInput(const ColumnWithTypeAndName & column) { input_columns.emplace_back(column.name, column.type); sample_block.insert(column); @@ -454,7 +454,7 @@ void ExpressionActions::addInput(const ColumnWithNameAndType & column) void ExpressionActions::addInput(const NameAndTypePair & column) { - addInput(ColumnWithNameAndType(nullptr, column.type, column.name)); + addInput(ColumnWithTypeAndName(nullptr, column.type, column.name)); } void ExpressionActions::add(const ExpressionAction & action, Names & out_new_columns) @@ -573,7 +573,7 @@ void ExpressionActions::executeOnTotals(Block & block) const { for (const auto & name_and_type : input_columns) { - ColumnWithNameAndType elem(name_and_type.type->createColumn(), name_and_type.type, name_and_type.name); + ColumnWithTypeAndName elem(name_and_type.type->createColumn(), name_and_type.type, name_and_type.name); elem.column->insertDefault(); block.insert(elem); } @@ -903,7 +903,7 @@ BlockInputStreamPtr ExpressionActions::createStreamWithNonJoinedDataIfFullOrRigh { Block left_sample_block; for (const auto & input_elem : input_columns) - left_sample_block.insert(ColumnWithNameAndType(nullptr, input_elem.type, input_elem.name)); + left_sample_block.insert(ColumnWithTypeAndName(nullptr, input_elem.type, input_elem.name)); return action.join->createStreamWithNonJoinedRows(left_sample_block, max_block_size); } @@ -918,7 +918,7 @@ void ExpressionActionsChain::addStep() if (steps.empty()) throw Exception("Cannot add action to empty ExpressionActionsChain", ErrorCodes::LOGICAL_ERROR); - ColumnsWithNameAndType columns = steps.back().actions->getSampleBlock().getColumns(); + ColumnsWithTypeAndName columns = steps.back().actions->getSampleBlock().getColumns(); steps.push_back(Step(new ExpressionActions(columns, settings))); } diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index 1f5cd00a5ad..1bfa59bb25b 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -1011,7 +1011,7 @@ struct ExpressionAnalyzer::ScopeStack stack.emplace_back(); Level & prev = stack[stack.size() - 2]; - ColumnsWithNameAndType all_columns; + ColumnsWithTypeAndName all_columns; NameSet new_names; for (NamesAndTypesList::const_iterator it = input_columns.begin(); it != input_columns.end(); ++it) @@ -1024,7 +1024,7 @@ struct ExpressionAnalyzer::ScopeStack const Block & prev_sample_block = prev.actions->getSampleBlock(); for (size_t i = 0, size = prev_sample_block.columns(); i < size; ++i) { - const ColumnWithNameAndType & col = prev_sample_block.unsafeGetByPosition(i); + const ColumnWithTypeAndName & col = prev_sample_block.unsafeGetByPosition(i); if (!new_names.count(col.name)) all_columns.push_back(col); } @@ -1057,7 +1057,7 @@ struct ExpressionAnalyzer::ScopeStack for (size_t i = 0; i < added.size(); ++i) { - const ColumnWithNameAndType & col = stack[level].actions->getSampleBlock().getByName(added[i]); + const ColumnWithTypeAndName & col = stack[level].actions->getSampleBlock().getByName(added[i]); for (size_t j = level + 1; j < stack.size(); ++j) stack[j].actions->addInput(col); } @@ -1234,7 +1234,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl { /// Мы в той части дерева, которую не собираемся вычислять. Нужно только определить типы. /// Не будем выполнять подзапросы и составлять множества. Вставим произвольный столбец правильного типа. - ColumnWithNameAndType fake_column; + ColumnWithTypeAndName fake_column; fake_column.name = node->getColumnName(); fake_column.type = new DataTypeUInt8; actions_stack.addAction(ExpressionAction::addColumn(fake_column)); @@ -1275,7 +1275,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl } else if (set) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.type = new DataTypeSet; /// Если аргумент - множество, заданное перечислением значений, дадим ему уникальное имя, @@ -1370,7 +1370,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl /// потому что оно не однозначно определяет выражение (типы аргументов могут быть разными). argument_names[i] = getUniqueName(actions_stack.getSampleBlock(), "__lambda"); - ColumnWithNameAndType lambda_column; + ColumnWithTypeAndName lambda_column; lambda_column.column = new ColumnExpression(1, lambda_actions, lambda_arguments, result_type, result_name); lambda_column.type = argument_types[i]; lambda_column.name = argument_names[i]; @@ -1400,7 +1400,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl { DataTypePtr type = apply_visitor(FieldToDataType(), node->value); - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.column = type->createConstColumn(1, node->value); column.type = type; column.name = node->getColumnName(); diff --git a/dbms/src/Interpreters/InterpreterInsertQuery.cpp b/dbms/src/Interpreters/InterpreterInsertQuery.cpp index e328218a77a..cd9da42f770 100644 --- a/dbms/src/Interpreters/InterpreterInsertQuery.cpp +++ b/dbms/src/Interpreters/InterpreterInsertQuery.cpp @@ -54,7 +54,7 @@ Block InterpreterInsertQuery::getSampleBlock() if (!table_sample.has(current_name)) throw Exception("No such column " + current_name + " in table " + query.table, ErrorCodes::NO_SUCH_COLUMN_IN_TABLE); - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = current_name; col.type = table_sample.getByName(current_name).type; col.column = col.type->createColumn(); diff --git a/dbms/src/Interpreters/InterpreterSelectQuery.cpp b/dbms/src/Interpreters/InterpreterSelectQuery.cpp index c71a9653046..d520dd275cd 100644 --- a/dbms/src/Interpreters/InterpreterSelectQuery.cpp +++ b/dbms/src/Interpreters/InterpreterSelectQuery.cpp @@ -299,7 +299,7 @@ Block InterpreterSelectQuery::getSampleBlock() /// писать (читать) с помощью BlockOut(In)putStream'ов for (size_t i = 0; i < block.columns(); ++i) { - ColumnWithNameAndType & col = block.getByPosition(i); + ColumnWithTypeAndName & col = block.getByPosition(i); col.column = col.type->createColumn(); } return block; diff --git a/dbms/src/Interpreters/Join.cpp b/dbms/src/Interpreters/Join.cpp index ce9479e2f91..6468be7ec38 100644 --- a/dbms/src/Interpreters/Join.cpp +++ b/dbms/src/Interpreters/Join.cpp @@ -553,8 +553,8 @@ void Join::joinBlockImpl(Block & block, const Maps & maps) const for (size_t i = 0; i < num_columns_to_add; ++i) { - const ColumnWithNameAndType & src_column = sample_block_with_columns_to_add.getByPosition(i); - ColumnWithNameAndType new_column = src_column.cloneEmpty(); + const ColumnWithTypeAndName & src_column = sample_block_with_columns_to_add.getByPosition(i); + ColumnWithTypeAndName new_column = src_column.cloneEmpty(); block.insert(new_column); added_columns[i] = new_column.column; added_columns[i]->reserve(src_column.column->size()); @@ -817,8 +817,8 @@ private: for (size_t i = 0; i < num_columns_right; ++i) { - const ColumnWithNameAndType & src_column = parent.sample_block_with_columns_to_add.getByPosition(i); - ColumnWithNameAndType new_column = src_column.cloneEmpty(); + const ColumnWithTypeAndName & src_column = parent.sample_block_with_columns_to_add.getByPosition(i); + ColumnWithTypeAndName new_column = src_column.cloneEmpty(); block.insert(new_column); columns_right[i] = new_column.column; columns_right[i]->reserve(src_column.column->size()); diff --git a/dbms/src/Interpreters/Set.cpp b/dbms/src/Interpreters/Set.cpp index e1dbb07b973..44fdcc82a1c 100644 --- a/dbms/src/Interpreters/Set.cpp +++ b/dbms/src/Interpreters/Set.cpp @@ -435,7 +435,7 @@ void Set::createFromAST(DataTypes & types, ASTPtr node, const Context & context, Block block; for (size_t i = 0, size = data_types.size(); i < size; ++i) { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.type = data_types[i]; col.column = data_types[i]->createColumn(); col.name = "_" + toString(i); diff --git a/dbms/src/Interpreters/tests/aggregate.cpp b/dbms/src/Interpreters/tests/aggregate.cpp index ecac301b9fe..26ed509c27e 100644 --- a/dbms/src/Interpreters/tests/aggregate.cpp +++ b/dbms/src/Interpreters/tests/aggregate.cpp @@ -24,7 +24,7 @@ int main(int argc, char ** argv) DB::Block block; - DB::ColumnWithNameAndType column_x; + DB::ColumnWithTypeAndName column_x; column_x.name = "x"; column_x.type = new DB::DataTypeInt16; DB::ColumnInt16 * x = new DB::ColumnInt16; @@ -39,7 +39,7 @@ int main(int argc, char ** argv) const char * strings[] = {"abc", "def", "abcd", "defg", "ac"}; - DB::ColumnWithNameAndType column_s1; + DB::ColumnWithTypeAndName column_s1; column_s1.name = "s1"; column_s1.type = new DB::DataTypeString; column_s1.column = new DB::ColumnString; @@ -49,7 +49,7 @@ int main(int argc, char ** argv) block.insert(column_s1); - DB::ColumnWithNameAndType column_s2; + DB::ColumnWithTypeAndName column_s2; column_s2.name = "s2"; column_s2.type = new DB::DataTypeString; column_s2.column = new DB::ColumnString; diff --git a/dbms/src/Interpreters/tests/expression.cpp b/dbms/src/Interpreters/tests/expression.cpp index e4c968b9dca..2d31181d3af 100644 --- a/dbms/src/Interpreters/tests/expression.cpp +++ b/dbms/src/Interpreters/tests/expression.cpp @@ -64,7 +64,7 @@ int main(int argc, char ** argv) Block block; - ColumnWithNameAndType column_x; + ColumnWithTypeAndName column_x; column_x.name = "x"; column_x.type = new DataTypeInt16; ColumnInt16 * x = new ColumnInt16; @@ -79,7 +79,7 @@ int main(int argc, char ** argv) const char * strings[] = {"abc", "def", "abcd", "defg", "ac"}; - ColumnWithNameAndType column_s1; + ColumnWithTypeAndName column_s1; column_s1.name = "s1"; column_s1.type = new DataTypeString; column_s1.column = new ColumnString; @@ -89,7 +89,7 @@ int main(int argc, char ** argv) block.insert(column_s1); - ColumnWithNameAndType column_s2; + ColumnWithTypeAndName column_s2; column_s2.name = "s2"; column_s2.type = new DataTypeString; column_s2.column = new ColumnString; diff --git a/dbms/src/Storages/ITableDeclaration.cpp b/dbms/src/Storages/ITableDeclaration.cpp index afd194f1642..83badf65ebe 100644 --- a/dbms/src/Storages/ITableDeclaration.cpp +++ b/dbms/src/Storages/ITableDeclaration.cpp @@ -256,7 +256,7 @@ void ITableDeclaration::check(const Block & block, bool need_all) const for (size_t i = 0; i < block.columns(); ++i) { - const ColumnWithNameAndType & column = block.getByPosition(i); + const ColumnWithTypeAndName & column = block.getByPosition(i); if (names_in_block.count(column.name)) throw Exception("Duplicate column " + column.name + " in block", diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index 3602747765d..11cb7d298d8 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -487,7 +487,7 @@ void MergeTreeData::createConvertExpression(const DataPartPtr & part, const Name if (!out_expression) out_expression = new ExpressionActions(NamesAndTypesList(), context.getSettingsRef()); - out_expression->addInput(ColumnWithNameAndType(nullptr, column.type, column.name)); + out_expression->addInput(ColumnWithTypeAndName(nullptr, column.type, column.name)); Names out_names; diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index 4ca213e4d0f..53ad4c2e66d 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -26,7 +26,7 @@ MergeTreeDataSelectExecutor::MergeTreeDataSelectExecutor(MergeTreeData & data_) static Block getBlockWithVirtualColumns(const MergeTreeData::DataPartsVector & parts) { Block res; - ColumnWithNameAndType _part(new ColumnString, new DataTypeString, "_part"); + ColumnWithTypeAndName _part(new ColumnString, new DataTypeString, "_part"); for (const auto & part : parts) _part.column->insert(part->name); diff --git a/dbms/src/Storages/MergeTree/PKCondition.cpp b/dbms/src/Storages/MergeTree/PKCondition.cpp index 152db1fdc7b..d0932601902 100644 --- a/dbms/src/Storages/MergeTree/PKCondition.cpp +++ b/dbms/src/Storages/MergeTree/PKCondition.cpp @@ -155,7 +155,7 @@ PKCondition::PKCondition(ASTPtr query, const Context & context_, const NamesAndT Block block_with_constants; /// В блоке должен быть хотя бы один столбец, чтобы у него было известно число строк. - ColumnWithNameAndType dummy_column; + ColumnWithTypeAndName dummy_column; dummy_column.name = "_dummy"; dummy_column.type = new DataTypeUInt8; dummy_column.column = new ColumnConstUInt8(1, 0); diff --git a/dbms/src/Storages/StorageBuffer.cpp b/dbms/src/Storages/StorageBuffer.cpp index ce17582f163..a327df0e6d6 100644 --- a/dbms/src/Storages/StorageBuffer.cpp +++ b/dbms/src/Storages/StorageBuffer.cpp @@ -84,7 +84,7 @@ protected: for (const auto & name : column_names) { auto & col = buffer.data.getByName(name); - res.insert(ColumnWithNameAndType(col.column->clone(), col.type, name)); + res.insert(ColumnWithTypeAndName(col.column->clone(), col.type, name)); } return res; diff --git a/dbms/src/Storages/StorageChunkMerger.cpp b/dbms/src/Storages/StorageChunkMerger.cpp index e314f127b08..78d88eb8fb9 100644 --- a/dbms/src/Storages/StorageChunkMerger.cpp +++ b/dbms/src/Storages/StorageChunkMerger.cpp @@ -207,7 +207,7 @@ BlockInputStreams StorageChunkMerger::read( Block StorageChunkMerger::getBlockWithVirtualColumns(const Storages & selected_tables) const { Block res; - ColumnWithNameAndType _table(new ColumnString, new DataTypeString, _table_column_name); + ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, _table_column_name); for (Storages::const_iterator it = selected_tables.begin(); it != selected_tables.end(); ++it) if ((*it)->getName() != "Chunks") diff --git a/dbms/src/Storages/StorageChunks.cpp b/dbms/src/Storages/StorageChunks.cpp index 5f5f4a577f2..dfe80918730 100644 --- a/dbms/src/Storages/StorageChunks.cpp +++ b/dbms/src/Storages/StorageChunks.cpp @@ -89,7 +89,7 @@ BlockInputStreams StorageChunks::read( Block StorageChunks::getBlockWithVirtualColumns() const { Block res; - ColumnWithNameAndType _table(new ColumnString, new DataTypeString, _table_column_name); + ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, _table_column_name); for (const auto & it : chunk_names) _table.column->insert(it); diff --git a/dbms/src/Storages/StorageLog.cpp b/dbms/src/Storages/StorageLog.cpp index f4bc9b587ae..ac1c80ef74a 100644 --- a/dbms/src/Storages/StorageLog.cpp +++ b/dbms/src/Storages/StorageLog.cpp @@ -212,7 +212,7 @@ Block LogBlockInputStream::readImpl() if (*it == storage._table_column_name) continue; - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.name = *it; column.type = storage.getDataTypeByName(*it); @@ -256,7 +256,7 @@ Block LogBlockInputStream::readImpl() if (rows > 0) { ColumnPtr column_ptr = ColumnConst (rows, current_table.first, new DataTypeString).convertToFullColumn(); - ColumnWithNameAndType column(column_ptr, new DataTypeString, storage._table_column_name); + ColumnWithTypeAndName column(column_ptr, new DataTypeString, storage._table_column_name); res.insert(column); } } @@ -341,7 +341,7 @@ void LogBlockOutputStream::write(const Block & block) marks.reserve(storage.files.size()); for (size_t i = 0; i < block.columns(); ++i) { - const ColumnWithNameAndType & column = block.getByPosition(i); + const ColumnWithTypeAndName & column = block.getByPosition(i); writeData(column.name, *column.type, *column.column, marks, offset_columns); } writeMarks(marks); diff --git a/dbms/src/Storages/StorageMerge.cpp b/dbms/src/Storages/StorageMerge.cpp index 61397f7c3e3..48f46d98335 100644 --- a/dbms/src/Storages/StorageMerge.cpp +++ b/dbms/src/Storages/StorageMerge.cpp @@ -186,7 +186,7 @@ BlockInputStreams StorageMerge::read( Block StorageMerge::getBlockWithVirtualColumns(const std::vector & selected_tables) const { Block res; - ColumnWithNameAndType _table(new ColumnString, new DataTypeString, "_table"); + ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, "_table"); for (StorageVector::const_iterator it = selected_tables.begin(); it != selected_tables.end(); ++it) _table.column->insert((*it)->getTableName()); diff --git a/dbms/src/Storages/StorageReplicatedMergeTree.cpp b/dbms/src/Storages/StorageReplicatedMergeTree.cpp index 2631bb43b4d..ac7ac1a7bc8 100644 --- a/dbms/src/Storages/StorageReplicatedMergeTree.cpp +++ b/dbms/src/Storages/StorageReplicatedMergeTree.cpp @@ -2014,7 +2014,7 @@ BlockInputStreams StorageReplicatedMergeTree::read( ColumnPtr column_ptr = column; column->getData()[0] = 0; column->getData()[1] = 1; - virtual_columns_block.insert(ColumnWithNameAndType(column_ptr, new DataTypeUInt8, "_replicated")); + virtual_columns_block.insert(ColumnWithTypeAndName(column_ptr, new DataTypeUInt8, "_replicated")); /// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать if (!virt_column_names.empty()) diff --git a/dbms/src/Storages/StorageSystemClusters.cpp b/dbms/src/Storages/StorageSystemClusters.cpp index be9bf3500ad..bc2a2128742 100644 --- a/dbms/src/Storages/StorageSystemClusters.cpp +++ b/dbms/src/Storages/StorageSystemClusters.cpp @@ -113,14 +113,14 @@ BlockInputStreams StorageSystemClusters::read( Block block; - block.insert(ColumnWithNameAndType(cluster_column, new DataTypeString, "cluster")); - block.insert(ColumnWithNameAndType(shard_num_column, new DataTypeUInt32, "shard_num")); - block.insert(ColumnWithNameAndType(shard_weight_column, new DataTypeUInt32, "shard_weight")); - block.insert(ColumnWithNameAndType(replica_num_column, new DataTypeUInt32, "replica_num")); - block.insert(ColumnWithNameAndType(host_name_column, new DataTypeString, "host_name")); - block.insert(ColumnWithNameAndType(host_address_column, new DataTypeString, "host_address")); - block.insert(ColumnWithNameAndType(port_column, new DataTypeUInt16, "port")); - block.insert(ColumnWithNameAndType(user_column, new DataTypeString, "user")); + block.insert(ColumnWithTypeAndName(cluster_column, new DataTypeString, "cluster")); + block.insert(ColumnWithTypeAndName(shard_num_column, new DataTypeUInt32, "shard_num")); + block.insert(ColumnWithTypeAndName(shard_weight_column, new DataTypeUInt32, "shard_weight")); + block.insert(ColumnWithTypeAndName(replica_num_column, new DataTypeUInt32, "replica_num")); + block.insert(ColumnWithTypeAndName(host_name_column, new DataTypeString, "host_name")); + block.insert(ColumnWithTypeAndName(host_address_column, new DataTypeString, "host_address")); + block.insert(ColumnWithTypeAndName(port_column, new DataTypeUInt16, "port")); + block.insert(ColumnWithTypeAndName(user_column, new DataTypeString, "user")); return BlockInputStreams{ 1, new OneBlockInputStream(block) }; } diff --git a/dbms/src/Storages/StorageSystemColumns.cpp b/dbms/src/Storages/StorageSystemColumns.cpp index f7f38eae975..83ced0d22f4 100644 --- a/dbms/src/Storages/StorageSystemColumns.cpp +++ b/dbms/src/Storages/StorageSystemColumns.cpp @@ -50,7 +50,7 @@ BlockInputStreams StorageSystemColumns::read( ColumnPtr database_column = new ColumnString; for (const auto & database : databases) database_column->insert(database.first); - block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database")); + block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database")); /// Отфильтруем блок со столбцом database. VirtualColumnUtils::filterBlockWithQuery(query, block, context); @@ -84,7 +84,7 @@ BlockInputStreams StorageSystemColumns::read( column = column->replicate(offsets); } - block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table")); + block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table")); } /// Отфильтруем блок со столбцами database и table. @@ -145,12 +145,12 @@ BlockInputStreams StorageSystemColumns::read( block.clear(); - block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database")); - block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table")); - block.insert(ColumnWithNameAndType(name_column, new DataTypeString, "name")); - block.insert(ColumnWithNameAndType(type_column, new DataTypeString, "type")); - block.insert(ColumnWithNameAndType(default_type_column, new DataTypeString, "default_type")); - block.insert(ColumnWithNameAndType(default_expression_column, new DataTypeString, "default_expression")); + block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database")); + block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table")); + block.insert(ColumnWithTypeAndName(name_column, new DataTypeString, "name")); + block.insert(ColumnWithTypeAndName(type_column, new DataTypeString, "type")); + block.insert(ColumnWithTypeAndName(default_type_column, new DataTypeString, "default_type")); + block.insert(ColumnWithTypeAndName(default_expression_column, new DataTypeString, "default_expression")); return BlockInputStreams{ 1, new OneBlockInputStream(block) }; } diff --git a/dbms/src/Storages/StorageSystemDatabases.cpp b/dbms/src/Storages/StorageSystemDatabases.cpp index 9d61eda4287..43ca9d51f34 100644 --- a/dbms/src/Storages/StorageSystemDatabases.cpp +++ b/dbms/src/Storages/StorageSystemDatabases.cpp @@ -33,7 +33,7 @@ BlockInputStreams StorageSystemDatabases::read( Block block; - ColumnWithNameAndType col_name; + ColumnWithTypeAndName col_name; col_name.name = "name"; col_name.type = new DataTypeString; col_name.column = new ColumnString; diff --git a/dbms/src/Storages/StorageSystemDictionaries.cpp b/dbms/src/Storages/StorageSystemDictionaries.cpp index b9ac093daea..ae50b91e3be 100644 --- a/dbms/src/Storages/StorageSystemDictionaries.cpp +++ b/dbms/src/Storages/StorageSystemDictionaries.cpp @@ -54,28 +54,28 @@ BlockInputStreams StorageSystemDictionaries::read( check(column_names); processed_stage = QueryProcessingStage::FetchColumns; - ColumnWithNameAndType col_name{new ColumnString, new DataTypeString, "name"}; - ColumnWithNameAndType col_origin{new ColumnString, new DataTypeString, "origin"}; - ColumnWithNameAndType col_type{new ColumnString, new DataTypeString, "type"}; - ColumnWithNameAndType col_attribute_names{ + ColumnWithTypeAndName col_name{new ColumnString, new DataTypeString, "name"}; + ColumnWithTypeAndName col_origin{new ColumnString, new DataTypeString, "origin"}; + ColumnWithTypeAndName col_type{new ColumnString, new DataTypeString, "type"}; + ColumnWithTypeAndName col_attribute_names{ new ColumnArray{new ColumnString}, new DataTypeArray{new DataTypeString}, "attribute.names" }; - ColumnWithNameAndType col_attribute_types{ + ColumnWithTypeAndName col_attribute_types{ new ColumnArray{new ColumnString}, new DataTypeArray{new DataTypeString}, "attribute.types" }; - ColumnWithNameAndType col_has_hierarchy{new ColumnUInt8, new DataTypeUInt8, "has_hierarchy"}; - ColumnWithNameAndType col_bytes_allocated{new ColumnUInt64, new DataTypeUInt64, "bytes_allocated"}; - ColumnWithNameAndType col_query_count{new ColumnUInt64, new DataTypeUInt64, "query_count"}; - ColumnWithNameAndType col_hit_rate{new ColumnFloat64, new DataTypeFloat64, "hit_rate"}; - ColumnWithNameAndType col_element_count{new ColumnUInt64, new DataTypeUInt64, "element_count"}; - ColumnWithNameAndType col_load_factor{new ColumnFloat64, new DataTypeFloat64, "load_factor"}; - ColumnWithNameAndType col_creation_time{new ColumnUInt32, new DataTypeDateTime, "creation_time"}; - ColumnWithNameAndType col_last_exception{new ColumnString, new DataTypeString, "last_exception"}; - ColumnWithNameAndType col_source{new ColumnString, new DataTypeString, "source"}; + ColumnWithTypeAndName col_has_hierarchy{new ColumnUInt8, new DataTypeUInt8, "has_hierarchy"}; + ColumnWithTypeAndName col_bytes_allocated{new ColumnUInt64, new DataTypeUInt64, "bytes_allocated"}; + ColumnWithTypeAndName col_query_count{new ColumnUInt64, new DataTypeUInt64, "query_count"}; + ColumnWithTypeAndName col_hit_rate{new ColumnFloat64, new DataTypeFloat64, "hit_rate"}; + ColumnWithTypeAndName col_element_count{new ColumnUInt64, new DataTypeUInt64, "element_count"}; + ColumnWithTypeAndName col_load_factor{new ColumnFloat64, new DataTypeFloat64, "load_factor"}; + ColumnWithTypeAndName col_creation_time{new ColumnUInt32, new DataTypeDateTime, "creation_time"}; + ColumnWithTypeAndName col_last_exception{new ColumnString, new DataTypeString, "last_exception"}; + ColumnWithTypeAndName col_source{new ColumnString, new DataTypeString, "source"}; const auto & external_dictionaries = context.getExternalDictionaries(); const std::lock_guard lock{external_dictionaries.dictionaries_mutex}; diff --git a/dbms/src/Storages/StorageSystemEvents.cpp b/dbms/src/Storages/StorageSystemEvents.cpp index 0f103e066f7..53cea0715e7 100644 --- a/dbms/src/Storages/StorageSystemEvents.cpp +++ b/dbms/src/Storages/StorageSystemEvents.cpp @@ -40,13 +40,13 @@ BlockInputStreams StorageSystemEvents::read( Block block; - ColumnWithNameAndType col_event; + ColumnWithTypeAndName col_event; col_event.name = "event"; col_event.type = new DataTypeString; col_event.column = new ColumnString; block.insert(col_event); - ColumnWithNameAndType col_value; + ColumnWithTypeAndName col_value; col_value.name = "value"; col_value.type = new DataTypeUInt64; col_value.column = new ColumnUInt64; diff --git a/dbms/src/Storages/StorageSystemFunctions.cpp b/dbms/src/Storages/StorageSystemFunctions.cpp index f19ea02ce89..74015428e1d 100644 --- a/dbms/src/Storages/StorageSystemFunctions.cpp +++ b/dbms/src/Storages/StorageSystemFunctions.cpp @@ -36,8 +36,8 @@ BlockInputStreams StorageSystemFunctions::read( check(column_names); processed_stage = QueryProcessingStage::FetchColumns; - ColumnWithNameAndType column_name{ new ColumnString, new DataTypeString, "name" }; - ColumnWithNameAndType column_is_aggregate{ new ColumnUInt8, new DataTypeUInt8, "is_aggregate" }; + ColumnWithTypeAndName column_name{ new ColumnString, new DataTypeString, "name" }; + ColumnWithTypeAndName column_is_aggregate{ new ColumnUInt8, new DataTypeUInt8, "is_aggregate" }; const auto & functions = FunctionFactory::instance().functions; for (const auto & it : functions) diff --git a/dbms/src/Storages/StorageSystemMerges.cpp b/dbms/src/Storages/StorageSystemMerges.cpp index 35456afd0da..17a6e21449f 100644 --- a/dbms/src/Storages/StorageSystemMerges.cpp +++ b/dbms/src/Storages/StorageSystemMerges.cpp @@ -46,18 +46,18 @@ BlockInputStreams StorageSystemMerges::read( check(column_names); processed_stage = QueryProcessingStage::FetchColumns; - ColumnWithNameAndType col_database{new ColumnString, new DataTypeString, "database"}; - ColumnWithNameAndType col_table{new ColumnString, new DataTypeString, "table"}; - ColumnWithNameAndType col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"}; - ColumnWithNameAndType col_progress{new ColumnFloat64, new DataTypeFloat64, "progress"}; - ColumnWithNameAndType col_num_parts{new ColumnUInt64, new DataTypeUInt64, "num_parts"}; - ColumnWithNameAndType col_result_part_name{new ColumnString, new DataTypeString, "result_part_name"}; - ColumnWithNameAndType col_total_size_bytes_compressed{new ColumnUInt64, new DataTypeUInt64, "total_size_bytes_compressed"}; - ColumnWithNameAndType col_total_size_marks{new ColumnUInt64, new DataTypeUInt64, "total_size_marks"}; - ColumnWithNameAndType col_bytes_read_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_read_uncompressed"}; - ColumnWithNameAndType col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"}; - ColumnWithNameAndType col_bytes_written_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_written_uncompressed"}; - ColumnWithNameAndType col_rows_written{new ColumnUInt64, new DataTypeUInt64, "rows_written"}; + ColumnWithTypeAndName col_database{new ColumnString, new DataTypeString, "database"}; + ColumnWithTypeAndName col_table{new ColumnString, new DataTypeString, "table"}; + ColumnWithTypeAndName col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"}; + ColumnWithTypeAndName col_progress{new ColumnFloat64, new DataTypeFloat64, "progress"}; + ColumnWithTypeAndName col_num_parts{new ColumnUInt64, new DataTypeUInt64, "num_parts"}; + ColumnWithTypeAndName col_result_part_name{new ColumnString, new DataTypeString, "result_part_name"}; + ColumnWithTypeAndName col_total_size_bytes_compressed{new ColumnUInt64, new DataTypeUInt64, "total_size_bytes_compressed"}; + ColumnWithTypeAndName col_total_size_marks{new ColumnUInt64, new DataTypeUInt64, "total_size_marks"}; + ColumnWithTypeAndName col_bytes_read_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_read_uncompressed"}; + ColumnWithTypeAndName col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"}; + ColumnWithTypeAndName col_bytes_written_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_written_uncompressed"}; + ColumnWithTypeAndName col_rows_written{new ColumnUInt64, new DataTypeUInt64, "rows_written"}; for (const auto & merge : context.getMergeList().get()) { diff --git a/dbms/src/Storages/StorageSystemNumbers.cpp b/dbms/src/Storages/StorageSystemNumbers.cpp index 92879353ed8..6da2515b774 100644 --- a/dbms/src/Storages/StorageSystemNumbers.cpp +++ b/dbms/src/Storages/StorageSystemNumbers.cpp @@ -27,7 +27,7 @@ protected: { Block res; - ColumnWithNameAndType column_with_name_and_type; + ColumnWithTypeAndName column_with_name_and_type; column_with_name_and_type.name = "number"; column_with_name_and_type.type = new DataTypeUInt64(); diff --git a/dbms/src/Storages/StorageSystemOne.cpp b/dbms/src/Storages/StorageSystemOne.cpp index 6ddcce51843..421ce9fea41 100644 --- a/dbms/src/Storages/StorageSystemOne.cpp +++ b/dbms/src/Storages/StorageSystemOne.cpp @@ -35,7 +35,7 @@ BlockInputStreams StorageSystemOne::read( processed_stage = QueryProcessingStage::FetchColumns; Block block; - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.name = "dummy"; col.type = new DataTypeUInt8; col.column = ColumnConstUInt8(1, 0).convertToFullColumn(); diff --git a/dbms/src/Storages/StorageSystemParts.cpp b/dbms/src/Storages/StorageSystemParts.cpp index 6949d06fa10..67f6170dc0b 100644 --- a/dbms/src/Storages/StorageSystemParts.cpp +++ b/dbms/src/Storages/StorageSystemParts.cpp @@ -74,7 +74,7 @@ BlockInputStreams StorageSystemParts::read( ColumnPtr database_column = new ColumnString; for (const auto & database : databases) database_column->insert(database.first); - block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database")); + block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database")); /// Отфильтруем блок со столбцом database. VirtualColumnUtils::filterBlockWithQuery(query, block, context); @@ -137,10 +137,10 @@ BlockInputStreams StorageSystemParts::read( column = column->replicate(offsets); } - block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table")); - block.insert(ColumnWithNameAndType(engine_column, new DataTypeString, "engine")); - block.insert(ColumnWithNameAndType(replicated_column, new DataTypeUInt8, "replicated")); - block.insert(ColumnWithNameAndType(active_column, new DataTypeUInt8, "active")); + block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table")); + block.insert(ColumnWithTypeAndName(engine_column, new DataTypeString, "engine")); + block.insert(ColumnWithTypeAndName(replicated_column, new DataTypeUInt8, "replicated")); + block.insert(ColumnWithTypeAndName(active_column, new DataTypeUInt8, "active")); } /// Отфильтруем блок со столбцами database, table, engine, replicated и active. @@ -252,23 +252,23 @@ BlockInputStreams StorageSystemParts::read( block.clear(); - block.insert(ColumnWithNameAndType(partition_column, new DataTypeString, "partition")); - block.insert(ColumnWithNameAndType(name_column, new DataTypeString, "name")); - block.insert(ColumnWithNameAndType(replicated_column, new DataTypeUInt8, "replicated")); - block.insert(ColumnWithNameAndType(active_column, new DataTypeUInt8, "active")); - block.insert(ColumnWithNameAndType(marks_column, new DataTypeUInt64, "marks")); - block.insert(ColumnWithNameAndType(bytes_column, new DataTypeUInt64, "bytes")); - block.insert(ColumnWithNameAndType(modification_time_column, new DataTypeDateTime, "modification_time")); - block.insert(ColumnWithNameAndType(remove_time_column, new DataTypeDateTime, "remove_time")); - block.insert(ColumnWithNameAndType(refcount_column, new DataTypeUInt32, "refcount")); - block.insert(ColumnWithNameAndType(min_date_column, new DataTypeDate, "min_date")); - block.insert(ColumnWithNameAndType(max_date_column, new DataTypeDate, "max_date")); - block.insert(ColumnWithNameAndType(min_block_number_column, new DataTypeUInt64, "min_block_number")); - block.insert(ColumnWithNameAndType(max_block_number_column, new DataTypeUInt64, "max_block_number")); - block.insert(ColumnWithNameAndType(level_column, new DataTypeUInt32, "level")); - block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database")); - block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table")); - block.insert(ColumnWithNameAndType(engine_column, new DataTypeString, "engine")); + block.insert(ColumnWithTypeAndName(partition_column, new DataTypeString, "partition")); + block.insert(ColumnWithTypeAndName(name_column, new DataTypeString, "name")); + block.insert(ColumnWithTypeAndName(replicated_column, new DataTypeUInt8, "replicated")); + block.insert(ColumnWithTypeAndName(active_column, new DataTypeUInt8, "active")); + block.insert(ColumnWithTypeAndName(marks_column, new DataTypeUInt64, "marks")); + block.insert(ColumnWithTypeAndName(bytes_column, new DataTypeUInt64, "bytes")); + block.insert(ColumnWithTypeAndName(modification_time_column, new DataTypeDateTime, "modification_time")); + block.insert(ColumnWithTypeAndName(remove_time_column, new DataTypeDateTime, "remove_time")); + block.insert(ColumnWithTypeAndName(refcount_column, new DataTypeUInt32, "refcount")); + block.insert(ColumnWithTypeAndName(min_date_column, new DataTypeDate, "min_date")); + block.insert(ColumnWithTypeAndName(max_date_column, new DataTypeDate, "max_date")); + block.insert(ColumnWithTypeAndName(min_block_number_column, new DataTypeUInt64, "min_block_number")); + block.insert(ColumnWithTypeAndName(max_block_number_column, new DataTypeUInt64, "max_block_number")); + block.insert(ColumnWithTypeAndName(level_column, new DataTypeUInt32, "level")); + block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database")); + block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table")); + block.insert(ColumnWithTypeAndName(engine_column, new DataTypeString, "engine")); return BlockInputStreams(1, new OneBlockInputStream(block)); } diff --git a/dbms/src/Storages/StorageSystemProcesses.cpp b/dbms/src/Storages/StorageSystemProcesses.cpp index ed083c6d9da..4ebd7fccc68 100644 --- a/dbms/src/Storages/StorageSystemProcesses.cpp +++ b/dbms/src/Storages/StorageSystemProcesses.cpp @@ -44,15 +44,15 @@ BlockInputStreams StorageSystemProcesses::read( check(column_names); processed_stage = QueryProcessingStage::FetchColumns; - ColumnWithNameAndType col_user{new ColumnString, new DataTypeString, "user"}; - ColumnWithNameAndType col_address{new ColumnString, new DataTypeString, "address"}; - ColumnWithNameAndType col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"}; - ColumnWithNameAndType col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"}; - ColumnWithNameAndType col_bytes_read{new ColumnUInt64, new DataTypeUInt64, "bytes_read"}; - ColumnWithNameAndType col_total_rows_approx{new ColumnUInt64, new DataTypeUInt64, "total_rows_approx"}; - ColumnWithNameAndType col_memory_usage{new ColumnUInt64, new DataTypeUInt64, "memory_usage"}; - ColumnWithNameAndType col_query{new ColumnString, new DataTypeString, "query"}; - ColumnWithNameAndType col_query_id{new ColumnString, new DataTypeString, "query_id"}; + ColumnWithTypeAndName col_user{new ColumnString, new DataTypeString, "user"}; + ColumnWithTypeAndName col_address{new ColumnString, new DataTypeString, "address"}; + ColumnWithTypeAndName col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"}; + ColumnWithTypeAndName col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"}; + ColumnWithTypeAndName col_bytes_read{new ColumnUInt64, new DataTypeUInt64, "bytes_read"}; + ColumnWithTypeAndName col_total_rows_approx{new ColumnUInt64, new DataTypeUInt64, "total_rows_approx"}; + ColumnWithTypeAndName col_memory_usage{new ColumnUInt64, new DataTypeUInt64, "memory_usage"}; + ColumnWithTypeAndName col_query{new ColumnString, new DataTypeString, "query"}; + ColumnWithTypeAndName col_query_id{new ColumnString, new DataTypeString, "query_id"}; for (const auto & process : context.getProcessList().get()) { diff --git a/dbms/src/Storages/StorageSystemReplicas.cpp b/dbms/src/Storages/StorageSystemReplicas.cpp index cb3cb59bb10..c02feb5a413 100644 --- a/dbms/src/Storages/StorageSystemReplicas.cpp +++ b/dbms/src/Storages/StorageSystemReplicas.cpp @@ -84,9 +84,9 @@ BlockInputStreams StorageSystemReplicas::read( } } - ColumnWithNameAndType col_database { new ColumnString, new DataTypeString, "database"}; - ColumnWithNameAndType col_table { new ColumnString, new DataTypeString, "table"}; - ColumnWithNameAndType col_engine { new ColumnString, new DataTypeString, "engine"}; + ColumnWithTypeAndName col_database { new ColumnString, new DataTypeString, "database"}; + ColumnWithTypeAndName col_table { new ColumnString, new DataTypeString, "table"}; + ColumnWithTypeAndName col_engine { new ColumnString, new DataTypeString, "engine"}; for (auto & db : replicated_tables) { @@ -112,25 +112,25 @@ BlockInputStreams StorageSystemReplicas::read( col_engine = filtered_block.getByName("engine"); } - ColumnWithNameAndType col_is_leader { new ColumnUInt8, new DataTypeUInt8, "is_leader"}; - ColumnWithNameAndType col_is_readonly { new ColumnUInt8, new DataTypeUInt8, "is_readonly"}; - ColumnWithNameAndType col_is_session_expired{ new ColumnUInt8, new DataTypeUInt8, "is_session_expired"}; - ColumnWithNameAndType col_future_parts { new ColumnUInt32, new DataTypeUInt32, "future_parts"}; - ColumnWithNameAndType col_parts_to_check { new ColumnUInt32, new DataTypeUInt32, "parts_to_check"}; - ColumnWithNameAndType col_zookeeper_path { new ColumnString, new DataTypeString, "zookeeper_path"}; - ColumnWithNameAndType col_replica_name { new ColumnString, new DataTypeString, "replica_name"}; - ColumnWithNameAndType col_replica_path { new ColumnString, new DataTypeString, "replica_path"}; - ColumnWithNameAndType col_columns_version { new ColumnInt32, new DataTypeInt32, "columns_version"}; - ColumnWithNameAndType col_queue_size { new ColumnUInt32, new DataTypeUInt32, "queue_size"}; - ColumnWithNameAndType col_inserts_in_queue { new ColumnUInt32, new DataTypeUInt32, "inserts_in_queue"}; - ColumnWithNameAndType col_merges_in_queue { new ColumnUInt32, new DataTypeUInt32, "merges_in_queue"}; - ColumnWithNameAndType col_queue_oldest_time { new ColumnUInt32, new DataTypeDateTime, "queue_oldest_time"}; - ColumnWithNameAndType col_inserts_oldest_time{ new ColumnUInt32,new DataTypeDateTime, "inserts_oldest_time"}; - ColumnWithNameAndType col_merges_oldest_time{ new ColumnUInt32, new DataTypeDateTime, "merges_oldest_time"}; - ColumnWithNameAndType col_log_max_index { new ColumnUInt64, new DataTypeUInt64, "log_max_index"}; - ColumnWithNameAndType col_log_pointer { new ColumnUInt64, new DataTypeUInt64, "log_pointer"}; - ColumnWithNameAndType col_total_replicas { new ColumnUInt8, new DataTypeUInt8, "total_replicas"}; - ColumnWithNameAndType col_active_replicas { new ColumnUInt8, new DataTypeUInt8, "active_replicas"}; + ColumnWithTypeAndName col_is_leader { new ColumnUInt8, new DataTypeUInt8, "is_leader"}; + ColumnWithTypeAndName col_is_readonly { new ColumnUInt8, new DataTypeUInt8, "is_readonly"}; + ColumnWithTypeAndName col_is_session_expired{ new ColumnUInt8, new DataTypeUInt8, "is_session_expired"}; + ColumnWithTypeAndName col_future_parts { new ColumnUInt32, new DataTypeUInt32, "future_parts"}; + ColumnWithTypeAndName col_parts_to_check { new ColumnUInt32, new DataTypeUInt32, "parts_to_check"}; + ColumnWithTypeAndName col_zookeeper_path { new ColumnString, new DataTypeString, "zookeeper_path"}; + ColumnWithTypeAndName col_replica_name { new ColumnString, new DataTypeString, "replica_name"}; + ColumnWithTypeAndName col_replica_path { new ColumnString, new DataTypeString, "replica_path"}; + ColumnWithTypeAndName col_columns_version { new ColumnInt32, new DataTypeInt32, "columns_version"}; + ColumnWithTypeAndName col_queue_size { new ColumnUInt32, new DataTypeUInt32, "queue_size"}; + ColumnWithTypeAndName col_inserts_in_queue { new ColumnUInt32, new DataTypeUInt32, "inserts_in_queue"}; + ColumnWithTypeAndName col_merges_in_queue { new ColumnUInt32, new DataTypeUInt32, "merges_in_queue"}; + ColumnWithTypeAndName col_queue_oldest_time { new ColumnUInt32, new DataTypeDateTime, "queue_oldest_time"}; + ColumnWithTypeAndName col_inserts_oldest_time{ new ColumnUInt32,new DataTypeDateTime, "inserts_oldest_time"}; + ColumnWithTypeAndName col_merges_oldest_time{ new ColumnUInt32, new DataTypeDateTime, "merges_oldest_time"}; + ColumnWithTypeAndName col_log_max_index { new ColumnUInt64, new DataTypeUInt64, "log_max_index"}; + ColumnWithTypeAndName col_log_pointer { new ColumnUInt64, new DataTypeUInt64, "log_pointer"}; + ColumnWithTypeAndName col_total_replicas { new ColumnUInt8, new DataTypeUInt8, "total_replicas"}; + ColumnWithTypeAndName col_active_replicas { new ColumnUInt8, new DataTypeUInt8, "active_replicas"}; for (size_t i = 0, size = col_database.column->size(); i < size; ++i) { diff --git a/dbms/src/Storages/StorageSystemSettings.cpp b/dbms/src/Storages/StorageSystemSettings.cpp index 61394db6470..a0fb04bf75e 100644 --- a/dbms/src/Storages/StorageSystemSettings.cpp +++ b/dbms/src/Storages/StorageSystemSettings.cpp @@ -37,9 +37,9 @@ BlockInputStreams StorageSystemSettings::read( check(column_names); processed_stage = QueryProcessingStage::FetchColumns; - ColumnWithNameAndType col_name{new ColumnString, new DataTypeString, "name"}; - ColumnWithNameAndType col_value{new ColumnString, new DataTypeString, "value"}; - ColumnWithNameAndType col_changed{new ColumnUInt8, new DataTypeUInt8, "changed"}; + ColumnWithTypeAndName col_name{new ColumnString, new DataTypeString, "name"}; + ColumnWithTypeAndName col_value{new ColumnString, new DataTypeString, "value"}; + ColumnWithTypeAndName col_changed{new ColumnUInt8, new DataTypeUInt8, "changed"}; #define ADD_SETTING(TYPE, NAME, DEFAULT) \ col_name.column->insert(String(#NAME)); \ diff --git a/dbms/src/Storages/StorageSystemTables.cpp b/dbms/src/Storages/StorageSystemTables.cpp index dc5c78d2558..b2fe8045512 100644 --- a/dbms/src/Storages/StorageSystemTables.cpp +++ b/dbms/src/Storages/StorageSystemTables.cpp @@ -26,9 +26,9 @@ StoragePtr StorageSystemTables::create(const std::string & name_) } -static ColumnWithNameAndType getFilteredDatabases(ASTPtr query, const Context & context) +static ColumnWithTypeAndName getFilteredDatabases(ASTPtr query, const Context & context) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.name = "database"; column.type = new DataTypeString; column.column = new ColumnString; @@ -58,19 +58,19 @@ BlockInputStreams StorageSystemTables::read( Block block; - ColumnWithNameAndType col_db; + ColumnWithTypeAndName col_db; col_db.name = "database"; col_db.type = new DataTypeString; col_db.column = new ColumnString; block.insert(col_db); - ColumnWithNameAndType col_name; + ColumnWithTypeAndName col_name; col_name.name = "name"; col_name.type = new DataTypeString; col_name.column = new ColumnString; block.insert(col_name); - ColumnWithNameAndType col_engine; + ColumnWithTypeAndName col_engine; col_engine.name = "engine"; col_engine.type = new DataTypeString; col_engine.column = new ColumnString; @@ -78,7 +78,7 @@ BlockInputStreams StorageSystemTables::read( Poco::ScopedLock lock(context.getMutex()); - ColumnWithNameAndType filtered_databases_column = getFilteredDatabases(query, context); + ColumnWithTypeAndName filtered_databases_column = getFilteredDatabases(query, context); for (size_t row_number = 0; row_number < filtered_databases_column.column->size(); ++row_number) { diff --git a/dbms/src/Storages/StorageSystemZooKeeper.cpp b/dbms/src/Storages/StorageSystemZooKeeper.cpp index 58f60303a7f..12344b6fb9c 100644 --- a/dbms/src/Storages/StorageSystemZooKeeper.cpp +++ b/dbms/src/Storages/StorageSystemZooKeeper.cpp @@ -119,20 +119,20 @@ BlockInputStreams StorageSystemZooKeeper::read( if (path.empty()) throw Exception("SELECT from system.zookeeper table must contain condition like path = 'path' in WHERE clause."); - ColumnWithNameAndType col_name { new ColumnString, new DataTypeString, "name" }; - ColumnWithNameAndType col_value { new ColumnString, new DataTypeString, "value" }; - ColumnWithNameAndType col_czxid { new ColumnInt64, new DataTypeInt64, "czxid" }; - ColumnWithNameAndType col_mzxid { new ColumnInt64, new DataTypeInt64, "mzxid" }; - ColumnWithNameAndType col_ctime { new ColumnUInt32, new DataTypeDateTime, "ctime" }; - ColumnWithNameAndType col_mtime { new ColumnUInt32, new DataTypeDateTime, "mtime" }; - ColumnWithNameAndType col_version { new ColumnInt32, new DataTypeInt32, "version" }; - ColumnWithNameAndType col_cversion { new ColumnInt32, new DataTypeInt32, "cversion" }; - ColumnWithNameAndType col_aversion { new ColumnInt32, new DataTypeInt32, "aversion" }; - ColumnWithNameAndType col_ephemeralOwner{ new ColumnInt64, new DataTypeInt64, "ephemeralOwner" }; - ColumnWithNameAndType col_dataLength { new ColumnInt32, new DataTypeInt32, "dataLength" }; - ColumnWithNameAndType col_numChildren { new ColumnInt32, new DataTypeInt32, "numChildren" }; - ColumnWithNameAndType col_pzxid { new ColumnInt64, new DataTypeInt64, "pzxid" }; - ColumnWithNameAndType col_path { new ColumnString, new DataTypeString, "path" }; + ColumnWithTypeAndName col_name { new ColumnString, new DataTypeString, "name" }; + ColumnWithTypeAndName col_value { new ColumnString, new DataTypeString, "value" }; + ColumnWithTypeAndName col_czxid { new ColumnInt64, new DataTypeInt64, "czxid" }; + ColumnWithTypeAndName col_mzxid { new ColumnInt64, new DataTypeInt64, "mzxid" }; + ColumnWithTypeAndName col_ctime { new ColumnUInt32, new DataTypeDateTime, "ctime" }; + ColumnWithTypeAndName col_mtime { new ColumnUInt32, new DataTypeDateTime, "mtime" }; + ColumnWithTypeAndName col_version { new ColumnInt32, new DataTypeInt32, "version" }; + ColumnWithTypeAndName col_cversion { new ColumnInt32, new DataTypeInt32, "cversion" }; + ColumnWithTypeAndName col_aversion { new ColumnInt32, new DataTypeInt32, "aversion" }; + ColumnWithTypeAndName col_ephemeralOwner{ new ColumnInt64, new DataTypeInt64, "ephemeralOwner" }; + ColumnWithTypeAndName col_dataLength { new ColumnInt32, new DataTypeInt32, "dataLength" }; + ColumnWithTypeAndName col_numChildren { new ColumnInt32, new DataTypeInt32, "numChildren" }; + ColumnWithTypeAndName col_pzxid { new ColumnInt64, new DataTypeInt64, "pzxid" }; + ColumnWithTypeAndName col_path { new ColumnString, new DataTypeString, "path" }; zkutil::ZooKeeperPtr zookeeper = context.getZooKeeper(); diff --git a/dbms/src/Storages/StorageTinyLog.cpp b/dbms/src/Storages/StorageTinyLog.cpp index acde326fb58..89bc91d6084 100644 --- a/dbms/src/Storages/StorageTinyLog.cpp +++ b/dbms/src/Storages/StorageTinyLog.cpp @@ -177,7 +177,7 @@ Block TinyLogBlockInputStream::readImpl() for (Names::const_iterator it = column_names.begin(); it != column_names.end(); ++it) { - ColumnWithNameAndType column; + ColumnWithTypeAndName column; column.name = *it; column.type = storage.getDataTypeByName(*it); @@ -334,7 +334,7 @@ void TinyLogBlockOutputStream::write(const Block & block) for (size_t i = 0; i < block.columns(); ++i) { - const ColumnWithNameAndType & column = block.getByPosition(i); + const ColumnWithTypeAndName & column = block.getByPosition(i); writeData(column.name, *column.type, *column.column, offset_columns); } } diff --git a/dbms/src/Storages/tests/hit_log.cpp b/dbms/src/Storages/tests/hit_log.cpp index 9a3da77fc67..7079414ce5b 100644 --- a/dbms/src/Storages/tests/hit_log.cpp +++ b/dbms/src/Storages/tests/hit_log.cpp @@ -109,7 +109,7 @@ int main(int argc, char ** argv) Block sample; for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it) { - ColumnWithNameAndType elem; + ColumnWithTypeAndName elem; elem.name = it->name; elem.type = it->type; elem.column = elem.type->createColumn(); diff --git a/dbms/src/Storages/tests/merge_tree.cpp b/dbms/src/Storages/tests/merge_tree.cpp index 720f2d3c1c5..64aee845380 100644 --- a/dbms/src/Storages/tests/merge_tree.cpp +++ b/dbms/src/Storages/tests/merge_tree.cpp @@ -53,7 +53,7 @@ int main(int argc, char ** argv) { Block block; - ColumnWithNameAndType column1; + ColumnWithTypeAndName column1; column1.name = "d"; column1.type = table->getDataTypeByName("d"); column1.column = column1.type->createColumn(); @@ -65,7 +65,7 @@ int main(int argc, char ** argv) block.insert(column1); - ColumnWithNameAndType column2; + ColumnWithTypeAndName column2; column2.name = "a"; column2.type = table->getDataTypeByName("a"); column2.column = column2.type->createColumn(); @@ -101,12 +101,12 @@ int main(int argc, char ** argv) Block sample; { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.type = names_and_types->front().type; sample.insert(col); } { - ColumnWithNameAndType col; + ColumnWithTypeAndName col; col.type = names_and_types->back().type; sample.insert(col); } diff --git a/dbms/src/Storages/tests/storage_log.cpp b/dbms/src/Storages/tests/storage_log.cpp index 55e0e9310a0..1fdb7391b65 100644 --- a/dbms/src/Storages/tests/storage_log.cpp +++ b/dbms/src/Storages/tests/storage_log.cpp @@ -33,7 +33,7 @@ int main(int argc, char ** argv) { DB::Block block; - DB::ColumnWithNameAndType column1; + DB::ColumnWithTypeAndName column1; column1.name = "a"; column1.type = table->getDataTypeByName("a"); column1.column = column1.type->createColumn(); @@ -45,7 +45,7 @@ int main(int argc, char ** argv) block.insert(column1); - DB::ColumnWithNameAndType column2; + DB::ColumnWithTypeAndName column2; column2.name = "b"; column2.type = table->getDataTypeByName("b"); column2.column = column2.type->createColumn(); @@ -73,12 +73,12 @@ int main(int argc, char ** argv) DB::Block sample; { - DB::ColumnWithNameAndType col; + DB::ColumnWithTypeAndName col; col.type = new DB::DataTypeUInt64; sample.insert(col); } { - DB::ColumnWithNameAndType col; + DB::ColumnWithTypeAndName col; col.type = new DB::DataTypeUInt8; sample.insert(col); } diff --git a/dbms/src/Storages/tests/system_numbers.cpp b/dbms/src/Storages/tests/system_numbers.cpp index 4c6dadc247f..2d4cc62a6cc 100644 --- a/dbms/src/Storages/tests/system_numbers.cpp +++ b/dbms/src/Storages/tests/system_numbers.cpp @@ -24,7 +24,7 @@ int main(int argc, char ** argv) column_names.push_back("number"); DB::Block sample; - DB::ColumnWithNameAndType col; + DB::ColumnWithTypeAndName col; col.type = new DB::DataTypeUInt64; sample.insert(col);