just add test

This commit is contained in:
jsc0218 2024-08-07 00:35:25 +00:00
parent 94dec67a46
commit 20c2d346a5
5 changed files with 14 additions and 41 deletions

View File

@ -366,31 +366,7 @@ bool MergeTreeIndexConditionBloomFilter::extractAtomFromTree(const RPNBuilderTre
}
}
if (node.isFunction())
{
/// Similar to the logic of KeyCondition, restrict the usage of bloom filter, in case of func like cast(c=1 or c=9999 as Bool).
const std::unordered_set<String> atom_map
{
"equals",
"notEquals",
"has",
"mapContains",
"indexOf",
"hasAny",
"hasAll",
"in",
"notIn",
"globalIn",
"globalNotIn"
};
auto func_name = node.toFunctionNode().getFunctionName();
if (atom_map.find(func_name) == std::end(atom_map))
return false;
}
bool res = traverseFunction(node, out, nullptr /*parent*/);
return res;
return traverseFunction(node, out, nullptr /*parent*/);
}
bool MergeTreeIndexConditionBloomFilter::traverseFunction(const RPNBuilderTreeNode & node, RPNElement & out, const RPNBuilderTreeNode * parent)

View File

@ -227,3 +227,5 @@
1 value1
1 value2
2 value3
1
1

View File

@ -374,3 +374,14 @@ SELECT id, ary[indexOf(ary, 'value2')] FROM test_bf_indexOf WHERE ary[indexOf(ar
SELECT id, ary[indexOf(ary, 'value3')] FROM test_bf_indexOf WHERE ary[indexOf(ary, 'value3')] = 'value3' ORDER BY id FORMAT TSV;
DROP TABLE IF EXISTS test_bf_indexOf;
-- expecting cast function to be unknown
DROP TABLE IF EXISTS test_bf_cast;
CREATE TABLE test_bf_cast (c Int32, INDEX x1 (c) type bloom_filter) ENGINE = MergeTree ORDER BY c as select 1;
SELECT count() FROM test_bf_cast WHERE cast(c=1 or c=9999 as Bool) settings use_skip_indexes=0;
SELECT count() FROM test_bf_cast WHERE cast(c=1 or c=9999 as Bool) settings use_skip_indexes=1;
DROP TABLE test_bf_cast;

View File

@ -1,14 +0,0 @@
drop table if exists t;
create table t (
c Int32,
index x1 (c) type bloom_filter
) engine=MergeTree order by c as select 1;
SELECT count() FROM t WHERE cast(c=1 or c=9999 as Bool)
settings use_skip_indexes=0;
SELECT count() FROM t WHERE cast(c=1 or c=9999 as Bool)
settings use_skip_indexes=1;
drop table t;