From a935db41692f26e293484619aab5854b6ae8e58c Mon Sep 17 00:00:00 2001 From: alesapin Date: Fri, 22 May 2020 15:34:26 +0300 Subject: [PATCH 1/2] boop CI --- src/Storages/IStorage.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Storages/IStorage.h b/src/Storages/IStorage.h index 62c94a22c02..f707b3a4b5c 100644 --- a/src/Storages/IStorage.h +++ b/src/Storages/IStorage.h @@ -446,27 +446,27 @@ public: /// Returns data paths if storage supports it, empty vector otherwise. virtual Strings getDataPaths() const { return {}; } - /// Returns structure with partition key + /// Returns structure with partition key. const StorageMetadataKeyField & getPartitionKey() const; /// Set partition key for storage (methods bellow, are just wrappers for this - /// struct) + /// struct). void setPartitionKey(const StorageMetadataKeyField & partition_key_); /// Returns ASTExpressionList of partition key expression for storage or nullptr if there is none. ASTPtr getPartitionKeyAST() const { return partition_key.definition_ast; } - /// Storage has partition key + /// Storage has partition key. bool hasPartitionKey() const; /// Returns column names that need to be read to calculate partition key. Names getColumnsRequiredForPartitionKey() const; - /// Returns structure with sorting key + /// Returns structure with sorting key. const StorageMetadataKeyField & getSortingKey() const; /// Set sorting key for storage (methods bellow, are just wrappers for this - /// struct) + /// struct). void setSortingKey(const StorageMetadataKeyField & sorting_key_); /// Returns ASTExpressionList of sorting key expression for storage or nullptr if there is none. ASTPtr getSortingKeyAST() const { return sorting_key.definition_ast; } - /// Storage has sorting key + /// Storage has sorting key. bool hasSortingKey() const; /// Returns column names that need to be read to calculate sorting key. Names getColumnsRequiredForSortingKey() const; @@ -474,16 +474,16 @@ public: /// expression. For example: 'a', 'x * y', 'toStartOfMonth(date)', etc. Names getSortingKeyColumns() const; - /// Returns structure with primary key + /// Returns structure with primary key. const StorageMetadataKeyField & getPrimaryKey() const; /// Set primary key for storage (methods bellow, are just wrappers for this - /// struct) + /// struct). void setPrimaryKey(const StorageMetadataKeyField & primary_key_); /// Returns ASTExpressionList of primary key expression for storage or nullptr if there is none. ASTPtr getPrimaryKeyAST() const { return primary_key.definition_ast; } - /// Storage has user-defined (in CREATE query) sorting key + /// Storage has user-defined (in CREATE query) sorting key. bool isPrimaryKeyDefined() const; - /// Storage has primary key (maybe part of some other key) + /// Storage has primary key (maybe part of some other key). bool hasPrimaryKey() const; /// Returns column names that need to be read to calculate primary key. Names getColumnsRequiredForPrimaryKey() const; @@ -491,14 +491,14 @@ public: /// * y', 'toStartOfMonth(date)', etc. Names getPrimaryKeyColumns() const; - /// Returns structure with sampling key + /// Returns structure with sampling key. const StorageMetadataKeyField & getSamplingKey() const; /// Set sampling key for storage (methods bellow, are just wrappers for this - /// struct) + /// struct). void setSamplingKey(const StorageMetadataKeyField & sampling_key_); /// Returns sampling expression AST for storage or nullptr if there is none. ASTPtr getSamplingKeyAST() const { return sampling_key.definition_ast; } - /// Storage has sampling key + /// Storage has sampling key. bool hasSamplingKey() const; /// Returns column names that need to be read to calculate sampling key. Names getColumnsRequiredForSampling() const; From e971ff627e287634d728c64d606c7a18869d3fc9 Mon Sep 17 00:00:00 2001 From: alesapin Date: Fri, 22 May 2020 17:39:16 +0300 Subject: [PATCH 2/2] Fix gcc-9 build --- src/Storages/MergeTree/MergeTreeData.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index 728bfa18bd8..3f8591441b9 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -152,14 +152,14 @@ MergeTreeData::MergeTreeData( if (metadata.sample_by_ast != nullptr) { - StorageMetadataKeyField sampling_key = StorageMetadataKeyField::getKeyFromAST(metadata.sample_by_ast, getColumns(), global_context); + StorageMetadataKeyField candidate_sampling_key = StorageMetadataKeyField::getKeyFromAST(metadata.sample_by_ast, getColumns(), global_context); - const auto & primary_key = getPrimaryKey(); - if (!primary_key.sample_block.has(sampling_key.column_names[0]) - && !attach && !settings->compatibility_allow_sampling_expression_not_in_primary_key) /// This is for backward compatibility. + const auto & pk_sample_block = getPrimaryKey().sample_block; + if (!pk_sample_block.has(candidate_sampling_key.column_names[0]) && !attach + && !settings->compatibility_allow_sampling_expression_not_in_primary_key) /// This is for backward compatibility. throw Exception("Sampling expression must be present in the primary key", ErrorCodes::BAD_ARGUMENTS); - setSamplingKey(sampling_key); + setSamplingKey(candidate_sampling_key); } MergeTreeDataFormatVersion min_format_version(0);