fix usage of non-materialized skip indexes

This commit is contained in:
Anton Popov 2021-12-07 20:21:27 +03:00
parent f064f2cdaa
commit dd7387729b
3 changed files with 16 additions and 2 deletions

View File

@ -147,9 +147,11 @@ struct IMergeTreeIndex
/// Returns extension for deserialization.
///
/// Return pair<extension, version>.
virtual MergeTreeIndexFormat getDeserializedFormat(const DiskPtr, const std::string & /* relative_path_prefix */) const
virtual MergeTreeIndexFormat getDeserializedFormat(const DiskPtr disk, const std::string & relative_path_prefix) const
{
return {1, ".idx"};
if (disk->exists(relative_path_prefix + ".idx"))
return {1, ".idx"};
return {0 /*unknown*/, ""};
}
/// Checks whether the column is in data skipping index.

View File

@ -0,0 +1,11 @@
DROP TABLE IF EXISTS t_index_non_materialized;
CREATE TABLE t_index_non_materialized (a UInt32) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t_index_non_materialized VALUES (1);
ALTER TABLE t_index_non_materialized ADD INDEX ind (a) TYPE set(1) GRANULARITY 1;
SELECT count() FROM t_index_non_materialized WHERE a = 1;
DROP TABLE t_index_non_materialized;