Fix set index with const column pred

This commit is contained in:
Amos Bird 2020-08-16 15:16:37 +08:00
parent b0ffde5825
commit ae2c50e9e8
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 10 additions and 1 deletions

View File

@ -291,7 +291,8 @@ bool MergeTreeIndexConditionSet::mayBeTrueOnGranule(MergeTreeIndexGranulePtr idx
Block result = granule->block;
actions->execute(result);
auto column = result.getByName(expression_ast->getColumnName()).column->convertToFullColumnIfLowCardinality();
auto column
= result.getByName(expression_ast->getColumnName()).column->convertToFullColumnIfConst()->convertToFullColumnIfLowCardinality();
const auto * col_uint8 = typeid_cast<const ColumnUInt8 *>(column.get());
const NullMap * null_map = nullptr;

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,7 @@
DROP TABLE IF EXISTS test_mtree;
CREATE TABLE test_mtree (`x` String, INDEX idx x TYPE set(10) GRANULARITY 1) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO test_mtree VALUES ('Hello, world');
SELECT count() FROM test_mtree WHERE x = NULL;
DROP TABLE test_mtree;