mayBeTrueOnGranule

This commit is contained in:
Nikita Vasilev 2019-05-12 20:08:28 +03:00
parent 3e02eaf28d
commit ee3c50e1a0
2 changed files with 7 additions and 4 deletions

View File

@ -140,6 +140,9 @@ bool MinMaxCondition::mayBeTrueOnGranule(MergeTreeIndexGranulePtr idx_granule) c
if (!granule)
throw Exception(
"Minmax index condition got a granule with the wrong type.", ErrorCodes::LOGICAL_ERROR);
for (const auto & range : granule->parallelogram)
if (range.left.isNull() || range.right.isNull())
return true;
return condition.mayBeTrueInParallelogram(granule->parallelogram, index.data_types);
}

View File

@ -9,16 +9,16 @@ CREATE TABLE min_max_with_nullable_string (
INSERT INTO min_max_with_nullable_string(t) VALUES (now()) (now());
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str == '.';
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str = '.';
INSERT INTO min_max_with_nullable_string(t, nullable_str) VALUES (now(), '.') (now(), '.');
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str == '.';
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str = '.';
INSERT INTO min_max_with_nullable_string(t, nullable_str) VALUES (now(), NULL) (now(), '.') (now(), NULL) (now(), '.') (now(), NULL);
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str == '.';
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str = '.';
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str == '';
SELECT count() FROM min_max_with_nullable_string WHERE nullable_str = '';
DROP TABLE min_max_with_nullable_string;