diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp index 1eb70920756..86b81b9c856 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp @@ -1039,7 +1039,6 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor new_data_part->index = source_part->index; new_data_part->partition.assign(source_part->partition); new_data_part->minmax_idx = source_part->minmax_idx; - new_data_part->index_parts = source_part->index_parts; new_data_part->modification_time = time(nullptr); new_data_part->bytes_on_disk = MergeTreeData::DataPart::calculateTotalSizeOnDisk(new_data_part->getFullPath()); } diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataPart.h b/dbms/src/Storages/MergeTree/MergeTreeDataPart.h index 1ae6aa602d0..90ea11e4141 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataPart.h +++ b/dbms/src/Storages/MergeTree/MergeTreeDataPart.h @@ -208,8 +208,6 @@ struct MergeTreeDataPart MinMaxIndex minmax_idx; - MergeTreeIndexParts index_parts; - Checksums checksums; /// Columns description. diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index 4eff75e567d..e38b92e1807 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -530,8 +530,8 @@ namespace DB /// It can be done in multiple threads (one thread for each part). /// Maybe it should be moved to BlockInputStream, but it can cause some problems. - for (auto index_part : part->index_parts) { - auto condition = index_part->createIndexConditionOnPart(query_info, context); + for (auto index : data.indexes) { + auto condition = index->createIndexConditionOnPart(query_info, context); if (!condition->alwaysUnknownOrTrue()) { ranges.ranges = condition->filterRanges(ranges.ranges); } diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndexes.cpp b/dbms/src/Storages/MergeTree/MergeTreeIndexes.cpp index f1ba281a747..c73999c2e3e 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndexes.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeIndexes.cpp @@ -12,11 +12,6 @@ namespace ErrorCodes IndexType IndexCondition::indexType() const { - return part->indexType(); -} - - -IndexType MergeTreeIndexPart::indexType() const { return index->indexType(); } diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h index 30fe6fb1cda..c0262794fa0 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h +++ b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h @@ -21,20 +21,16 @@ enum class IndexType { class MergeTreeIndex; -struct MergeTreeIndexPart; using MergeTreeIndexPtr = std::shared_ptr; using MutableMergeTreeIndexPtr = std::shared_ptr; using MergeTreeIndexes = std::vector; -using MergeTreeIndexPartPtr = std::shared_ptr; -using MergeTreeIndexParts = std::vector; - /// Condition on the index. /// It works only with one indexPart (MergeTreeDataPart). class IndexCondition { - friend MergeTreeIndexPart; + friend MergeTreeIndex; public: virtual ~IndexCondition() = default; @@ -51,7 +47,7 @@ protected: IndexCondition() = default; public: - MergeTreeIndexPartPtr part; + MergeTreeIndexPtr index; }; using IndexConditionPtr = std::shared_ptr; @@ -59,7 +55,7 @@ using IndexConditionPtr = std::shared_ptr; struct MergeTreeIndexGranule { - friend MergeTreeIndexPart; + friend MergeTreeIndex; public: virtual ~MergeTreeIndexGranule(); @@ -76,28 +72,6 @@ using MergeTreeIndexGranulePtr = std::shared_ptr; using MergeTreeIndexGranules = std::vector; -/// Data structure for operations with index data for each MergeTreeDataPart. -/// Stores information specific for DataPart. -/// Возможно будет убран. -struct MergeTreeIndexPart -{ - friend MergeTreeIndex; - -public: - MergeTreeIndexPart() = default; - virtual ~MergeTreeIndexPart() = default; - - IndexType indexType() const; - - virtual MergeTreeIndexPartPtr cloneEmpty() const = 0; - - virtual IndexConditionPtr createIndexConditionOnPart( - const SelectQueryInfo & query_info, const Context & context) const = 0; - - MergeTreeIndexPtr index; -}; - - /// Structure for storing basic index info like columns, expression, arguments, ... class MergeTreeIndex { @@ -111,6 +85,9 @@ public: virtual MergeTreeIndexGranulePtr createIndexGranule() const = 0; + virtual IndexConditionPtr createIndexConditionOnPart( + const SelectQueryInfo & query_info, const Context & context) const = 0; + String name; ExpressionActionsPtr expr; size_t granularity;