From 270a31abb5bd30504cc11a33f84295cebad4f594 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 2 May 2019 19:07:23 +0300 Subject: [PATCH] Rename method for consistency --- dbms/src/Interpreters/InterpreterCreateQuery.cpp | 2 +- dbms/src/Storages/IStorage.cpp | 2 +- dbms/src/Storages/ITableDeclaration.cpp | 2 +- dbms/src/Storages/ITableDeclaration.h | 4 ++-- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 12 ++++++------ .../MergeTree/ReplicatedMergeTreeAlterThread.cpp | 2 +- .../MergeTree/ReplicatedMergeTreeTableMetadata.cpp | 2 +- dbms/src/Storages/StorageBuffer.cpp | 2 +- dbms/src/Storages/StorageDistributed.cpp | 2 +- dbms/src/Storages/StorageMerge.cpp | 2 +- dbms/src/Storages/StorageMergeTree.cpp | 6 +++--- dbms/src/Storages/StorageMergeTree.h | 4 ++-- dbms/src/Storages/StorageNull.cpp | 2 +- dbms/src/Storages/StorageReplicatedMergeTree.cpp | 8 ++++---- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.cpp b/dbms/src/Interpreters/InterpreterCreateQuery.cpp index 4bc35f1e378..035b299ac5e 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterCreateQuery.cpp @@ -383,7 +383,7 @@ ColumnsDescription InterpreterCreateQuery::setColumns( else if (!create.as_table.empty()) { columns = as_storage->getColumns(); - indices = as_storage->getIndicesDescription(); + indices = as_storage->getIndices(); } else if (create.select) { diff --git a/dbms/src/Storages/IStorage.cpp b/dbms/src/Storages/IStorage.cpp index 697e919987c..451b0954f22 100644 --- a/dbms/src/Storages/IStorage.cpp +++ b/dbms/src/Storages/IStorage.cpp @@ -15,7 +15,7 @@ void IStorage::alter(const AlterCommands & params, const String & database_name, lockStructureExclusively(table_lock_holder, context.getCurrentQueryId()); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); params.apply(new_columns); context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {}); setColumns(std::move(new_columns)); diff --git a/dbms/src/Storages/ITableDeclaration.cpp b/dbms/src/Storages/ITableDeclaration.cpp index c9385c24cbe..86f509c0199 100644 --- a/dbms/src/Storages/ITableDeclaration.cpp +++ b/dbms/src/Storages/ITableDeclaration.cpp @@ -31,7 +31,7 @@ void ITableDeclaration::setColumns(ColumnsDescription columns_) columns = std::move(columns_); } -void ITableDeclaration::setIndicesDescription(IndicesDescription indices_) +void ITableDeclaration::setIndices(IndicesDescription indices_) { indices = std::move(indices_); } diff --git a/dbms/src/Storages/ITableDeclaration.h b/dbms/src/Storages/ITableDeclaration.h index e2ac3b1d6c4..ef5e0ebbed6 100644 --- a/dbms/src/Storages/ITableDeclaration.h +++ b/dbms/src/Storages/ITableDeclaration.h @@ -16,8 +16,8 @@ public: virtual const ColumnsDescription & getColumns() const { return columns; } virtual void setColumns(ColumnsDescription columns_); - virtual const IndicesDescription & getIndicesDescription() const { return indices; } - virtual void setIndicesDescription(IndicesDescription indices_); + virtual const IndicesDescription & getIndices() const { return indices; } + virtual void setIndices(IndicesDescription indices_); /// NOTE: These methods should include virtual columns, but should NOT include ALIAS columns /// (they are treated separately). diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index 453f680c6ba..2c2d2bc6dea 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -420,7 +420,7 @@ void MergeTreeData::setPrimaryKeyIndicesAndColumns( primary_key_sample = std::move(new_primary_key_sample); primary_key_data_types = std::move(new_primary_key_data_types); - setIndicesDescription(indices_description); + setIndices(indices_description); skip_indices = std::move(new_indices); primary_key_and_skip_indices_expr = new_indices_with_primary_key_expr; @@ -1177,13 +1177,13 @@ void MergeTreeData::checkAlter(const AlterCommands & commands, const Context & c { /// Check that needed transformations can be applied to the list of columns without considering type conversions. auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); ASTPtr new_order_by_ast = order_by_ast; ASTPtr new_primary_key_ast = primary_key_ast; ASTPtr new_ttl_table_ast = ttl_table_ast; commands.apply(new_columns, new_indices, new_order_by_ast, new_primary_key_ast, new_ttl_table_ast); - if (getIndicesDescription().empty() && !new_indices.empty() && + if (getIndices().empty() && !new_indices.empty() && !context.getSettingsRef().allow_experimental_data_skipping_indices) throw Exception("You must set the setting `allow_experimental_data_skipping_indices` to 1 " \ "before using data skipping indices.", ErrorCodes::BAD_ARGUMENTS); @@ -1274,7 +1274,7 @@ void MergeTreeData::checkAlter(const AlterCommands & commands, const Context & c NameToNameMap unused_map; bool unused_bool; createConvertExpression(nullptr, getColumns().getAllPhysical(), new_columns.getAllPhysical(), - getIndicesDescription().indices, new_indices.indices, unused_expression, unused_map, unused_bool); + getIndices().indices, new_indices.indices, unused_expression, unused_map, unused_bool); } void MergeTreeData::createConvertExpression(const DataPartPtr & part, const NamesAndTypesList & old_columns, const NamesAndTypesList & new_columns, @@ -1445,7 +1445,7 @@ MergeTreeData::AlterDataPartTransactionPtr MergeTreeData::alterDataPart( AlterDataPartTransactionPtr transaction(new AlterDataPartTransaction(part)); /// Blocks changes to the part. bool force_update_metadata; createConvertExpression(part, part->columns, new_columns, - getIndicesDescription().indices, new_indices, + getIndices().indices, new_indices, expression, transaction->rename_map, force_update_metadata); size_t num_files_to_modify = transaction->rename_map.size(); @@ -1597,7 +1597,7 @@ void MergeTreeData::removeEmptyColumnsFromPart(MergeTreeData::MutableDataPartPtr LOG_INFO(log, "Removing empty columns: " << log_message.str() << " from part " << data_part->name); - if (auto transaction = alterDataPart(data_part, new_columns, getIndicesDescription().indices, false)) + if (auto transaction = alterDataPart(data_part, new_columns, getIndices().indices, false)) transaction->commit(); empty_columns.clear(); } diff --git a/dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.cpp b/dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.cpp index 1b1c43e1cd1..05a141b4b8e 100644 --- a/dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.cpp +++ b/dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.cpp @@ -143,7 +143,7 @@ void ReplicatedMergeTreeAlterThread::run() parts = storage.data.getDataParts(); const auto columns_for_parts = storage.getColumns().getAllPhysical(); - const auto indices_for_parts = storage.getIndicesDescription(); + const auto indices_for_parts = storage.getIndices(); for (const MergeTreeData::DataPartPtr & part : parts) { diff --git a/dbms/src/Storages/MergeTree/ReplicatedMergeTreeTableMetadata.cpp b/dbms/src/Storages/MergeTree/ReplicatedMergeTreeTableMetadata.cpp index df2e6756dbe..b122785c5fd 100644 --- a/dbms/src/Storages/MergeTree/ReplicatedMergeTreeTableMetadata.cpp +++ b/dbms/src/Storages/MergeTree/ReplicatedMergeTreeTableMetadata.cpp @@ -45,7 +45,7 @@ ReplicatedMergeTreeTableMetadata::ReplicatedMergeTreeTableMetadata(const MergeTr if (data.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING) partition_key = formattedAST(MergeTreeData::extractKeyExpressionList(data.partition_by_ast)); - skip_indices = data.getIndicesDescription().toString(); + skip_indices = data.getIndices().toString(); index_granularity_bytes = data.index_granularity_info.index_granularity_bytes; ttl_table = formattedAST(data.ttl_table_ast); } diff --git a/dbms/src/Storages/StorageBuffer.cpp b/dbms/src/Storages/StorageBuffer.cpp index ea0753985d7..24e1ecef2e3 100644 --- a/dbms/src/Storages/StorageBuffer.cpp +++ b/dbms/src/Storages/StorageBuffer.cpp @@ -700,7 +700,7 @@ void StorageBuffer::alter(const AlterCommands & params, const String & database_ optimize({} /*query*/, {} /*partition_id*/, false /*final*/, false /*deduplicate*/, context); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); params.apply(new_columns); context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {}); setColumns(std::move(new_columns)); diff --git a/dbms/src/Storages/StorageDistributed.cpp b/dbms/src/Storages/StorageDistributed.cpp index aa140903496..849dc221409 100644 --- a/dbms/src/Storages/StorageDistributed.cpp +++ b/dbms/src/Storages/StorageDistributed.cpp @@ -344,7 +344,7 @@ void StorageDistributed::alter( lockStructureExclusively(table_lock_holder, context.getCurrentQueryId()); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); params.apply(new_columns); context.getDatabase(database_name)->alterTable(context, current_table_name, new_columns, new_indices, {}); setColumns(std::move(new_columns)); diff --git a/dbms/src/Storages/StorageMerge.cpp b/dbms/src/Storages/StorageMerge.cpp index ef33207a04f..fed40b246c8 100644 --- a/dbms/src/Storages/StorageMerge.cpp +++ b/dbms/src/Storages/StorageMerge.cpp @@ -402,7 +402,7 @@ void StorageMerge::alter( lockStructureExclusively(table_lock_holder, context.getCurrentQueryId()); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); params.apply(new_columns); context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {}); setColumns(new_columns); diff --git a/dbms/src/Storages/StorageMergeTree.cpp b/dbms/src/Storages/StorageMergeTree.cpp index 6ff9959a2f0..9ffbb866366 100644 --- a/dbms/src/Storages/StorageMergeTree.cpp +++ b/dbms/src/Storages/StorageMergeTree.cpp @@ -204,7 +204,7 @@ void StorageMergeTree::alter( { lockStructureExclusively(table_lock_holder, context.getCurrentQueryId()); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); params.apply(new_columns); context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {}); setColumns(std::move(new_columns)); @@ -219,7 +219,7 @@ void StorageMergeTree::alter( data.checkAlter(params, context); auto new_columns = data.getColumns(); - auto new_indices = data.getIndicesDescription(); + auto new_indices = data.getIndices(); ASTPtr new_order_by_ast = data.order_by_ast; ASTPtr new_primary_key_ast = data.primary_key_ast; ASTPtr new_ttl_table_ast = data.ttl_table_ast; @@ -800,7 +800,7 @@ void StorageMergeTree::clearColumnInPartition(const ASTPtr & partition, const Fi alter_command.column_name = get(column_name); auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); ASTPtr ignored_order_by_ast; ASTPtr ignored_primary_key_ast; ASTPtr ignored_ttl_table_ast; diff --git a/dbms/src/Storages/StorageMergeTree.h b/dbms/src/Storages/StorageMergeTree.h index c5ea2d8c3a0..3de3da0fa0e 100644 --- a/dbms/src/Storages/StorageMergeTree.h +++ b/dbms/src/Storages/StorageMergeTree.h @@ -43,8 +43,8 @@ public: const ColumnsDescription & getColumns() const override { return data.getColumns(); } void setColumns(ColumnsDescription columns_) override { return data.setColumns(std::move(columns_)); } - virtual const IndicesDescription & getIndicesDescription() const override { return data.getIndicesDescription(); } - virtual void setIndicesDescription(IndicesDescription indices_) override { data.setIndicesDescription(std::move(indices_)); } + virtual const IndicesDescription & getIndices() const override { return data.getIndices(); } + virtual void setIndices(IndicesDescription indices_) override { data.setIndices(std::move(indices_)); } NameAndTypePair getColumn(const String & column_name) const override { return data.getColumn(column_name); } bool hasColumn(const String & column_name) const override { return data.hasColumn(column_name); } diff --git a/dbms/src/Storages/StorageNull.cpp b/dbms/src/Storages/StorageNull.cpp index 176f70d3e9f..1762c8372f5 100644 --- a/dbms/src/Storages/StorageNull.cpp +++ b/dbms/src/Storages/StorageNull.cpp @@ -37,7 +37,7 @@ void StorageNull::alter( lockStructureExclusively(table_lock_holder, context.getCurrentQueryId()); ColumnsDescription new_columns = getColumns(); - IndicesDescription new_indices = getIndicesDescription(); + IndicesDescription new_indices = getIndices(); params.apply(new_columns); context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {}); setColumns(std::move(new_columns)); diff --git a/dbms/src/Storages/StorageReplicatedMergeTree.cpp b/dbms/src/Storages/StorageReplicatedMergeTree.cpp index 19751e112d7..fb63264c8e6 100644 --- a/dbms/src/Storages/StorageReplicatedMergeTree.cpp +++ b/dbms/src/Storages/StorageReplicatedMergeTree.cpp @@ -426,7 +426,7 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column { ASTPtr new_primary_key_ast = data.primary_key_ast; ASTPtr new_order_by_ast = data.order_by_ast; - auto new_indices = data.getIndicesDescription(); + auto new_indices = data.getIndices(); ASTPtr new_ttl_table_ast = data.ttl_table_ast; IDatabase::ASTModifier storage_modifier; if (!metadata_diff.empty()) @@ -1511,7 +1511,7 @@ void StorageReplicatedMergeTree::executeClearColumnInPartition(const LogEntry & alter_command.column_name = entry.column_name; auto new_columns = getColumns(); - auto new_indices = getIndicesDescription(); + auto new_indices = getIndices(); ASTPtr ignored_order_by_ast; ASTPtr ignored_primary_key_ast; ASTPtr ignored_ttl_table_ast; @@ -3117,7 +3117,7 @@ void StorageReplicatedMergeTree::alter( data.checkAlter(params, query_context); ColumnsDescription new_columns = data.getColumns(); - IndicesDescription new_indices = data.getIndicesDescription(); + IndicesDescription new_indices = data.getIndices(); ASTPtr new_order_by_ast = data.order_by_ast; ASTPtr new_primary_key_ast = data.primary_key_ast; ASTPtr new_ttl_table_ast = data.ttl_table_ast; @@ -3135,7 +3135,7 @@ void StorageReplicatedMergeTree::alter( new_metadata.ttl_table = serializeAST(*new_ttl_table_ast); String new_indices_str = new_indices.toString(); - if (new_indices_str != data.getIndicesDescription().toString()) + if (new_indices_str != data.getIndices().toString()) new_metadata.skip_indices = new_indices_str; String new_metadata_str = new_metadata.toString();