Fix Set index with constant nullable comparison.

This commit is contained in:
Nikolai Kochetov 2023-06-20 19:40:37 +00:00
parent 5867f39fc7
commit e4f057e304
3 changed files with 16 additions and 1 deletions

View File

@ -554,7 +554,7 @@ void MergeTreeIndexConditionSet::traverseAST(ASTPtr & node) const
if (atomFromAST(node)) if (atomFromAST(node))
{ {
if (node->as<ASTIdentifier>() || node->as<ASTFunction>()) if (node->as<ASTIdentifier>() || node->as<ASTFunction>())
node = makeASTFunction("__bitWrapperFunc", node); else
} }
else else
node = std::make_shared<ASTLiteral>(UNKNOWN_FIELD); node = std::make_shared<ASTLiteral>(UNKNOWN_FIELD);

View File

@ -0,0 +1,14 @@
CREATE OR REPLACE TABLE test_table
(
col1 String,
col2 String,
INDEX test_table_col2_idx col2 TYPE set(0) GRANULARITY 1
) ENGINE = MergeTree()
ORDER BY col1
AS SELECT 'v1', 'v2';
SELECT * FROM test_table
WHERE 1 == 1 AND col1 == col1 OR
0 AND col2 == NULL;
drop table if exists test_table;