diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h index 860e5747f3d..4e0853236a4 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h +++ b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h @@ -7,37 +7,45 @@ #include #include #include -#include #include namespace DB { +class MergeTreeIndexPart +{ +public: + virtual ~MergeTreeIndexPart() {}; + + virtual void update(const Block & block, const Names & column_names) = 0; + virtual void merge(const MergeTreeIndexPart & other) = 0; +}; + +using MergeTreeIndexPartPtr = std::unique_ptr; +using MergeTreeIndexParts = std::vector; + -/// Interface for secondary MergeTree indexes class MergeTreeIndex { public: + MergeTreeIndex(String name, ExpressionActionsPtr expr, Block key) + : name(name), expr(expr), sample(key) {} + virtual ~MergeTreeIndex() {}; - virtual void load(const String & part_path) = 0; - virtual void store(const String & part_path, MergeTreeDataPartChecksums & checksums) const = 0; - - virtual void update(const Block & block, const Names & column_names) = 0; - virtual void merge(const MergeTreeIndex & other) = 0; - virtual bool alwaysUnknownOrTrue() const = 0; - virtual bool maybeTrue() const = 0; + virtual bool maybeTrue(/* args */) const = 0; + + virtual MergeTreeIndexPartPtr createEmptyIndexPart() const = 0; String name; ExpressionActionsPtr expr; - Block header; + Block sample; }; using MergeTreeIndexPtr = std::unique_ptr; using MergeTreeIndexes = std::vector; - class MergeTreeIndexFactory : public ext::singleton { friend class ext::singleton; diff --git a/dbms/src/Storages/StorageReplicatedMergeTree.cpp b/dbms/src/Storages/StorageReplicatedMergeTree.cpp index 3e93b3f7528..0743cfce5e3 100644 --- a/dbms/src/Storages/StorageReplicatedMergeTree.cpp +++ b/dbms/src/Storages/StorageReplicatedMergeTree.cpp @@ -110,6 +110,7 @@ namespace ErrorCodes extern const int KEEPER_EXCEPTION; extern const int ALL_REPLICAS_LOST; extern const int REPLICA_STATUS_CHANGED; + extern const int INCORRECT_QUERY; } namespace ActionLocks @@ -225,6 +226,9 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree( { if (path_.empty()) throw Exception("ReplicatedMergeTree storages require data path", ErrorCodes::INCORRECT_FILE_NAME); + if (!indexes_ast_.empty()) { + throw Exception("ReplicatedMergeTree storages do not support indexes", ErrorCodes::INCORRECT_QUERY); + } if (!zookeeper_path.empty() && zookeeper_path.back() == '/') zookeeper_path.resize(zookeeper_path.size() - 1);