mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
just add test
This commit is contained in:
parent
94dec67a46
commit
20c2d346a5
@ -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)
|
||||
|
@ -227,3 +227,5 @@
|
||||
1 value1
|
||||
1 value2
|
||||
2 value3
|
||||
1
|
||||
1
|
||||
|
@ -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;
|
@ -1,2 +0,0 @@
|
||||
1
|
||||
1
|
@ -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;
|
Loading…
Reference in New Issue
Block a user