forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from Altinity/TMP/fix_20.3_bloom_filter_hasAny
[port of ClickHouse#24900 to Altinity 20.3] Added support of hasAny function to bloom_filter index. Validated by manual build and manual test run
- Loading branch information
Showing
4 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE bftest ( | ||
k Int64, | ||
x Array(Int64), | ||
index ix1(x) TYPE bloom_filter GRANULARITY 3 | ||
) | ||
Engine=MergeTree | ||
ORDER BY k; | ||
|
||
INSERT INTO bftest SELECT number, arrayMap(i->rand64()%565656, range(10)) FROM numbers(1000); | ||
|
||
SET force_data_skipping_indices='ix1'; | ||
SELECT count() FROM bftest WHERE has (x, 42) or has(x, -42) FORMAT Null; | ||
SELECT count() FROM bftest WHERE hasAny(x, [42,-42]) FORMAT Null; | ||
SELECT count() FROM bftest WHERE hasAny(x, []) FORMAT Null; | ||
SELECT count() FROM bftest WHERE hasAny(x, [1]) FORMAT Null; | ||
|
||
-- can't use bloom_filter with `hasAny` on non-constant arguments (just like `has`) | ||
SELECT count() FROM bftest WHERE hasAny(x, materialize([1,2,3])) FORMAT Null; -- { serverError 277 } | ||
|
||
-- NULLs are not Ok | ||
SELECT count() FROM bftest WHERE hasAny(x, [NULL,-42]) FORMAT Null; -- { serverError 43 } | ||
SELECT count() FROM bftest WHERE hasAny(x, [0,NULL]) FORMAT Null; -- { serverError 43 } | ||
|
||
-- non-compatible types | ||
SELECT count() FROM bftest WHERE hasAny(x, [[123], -42]) FORMAT Null; -- { serverError 386 } | ||
SELECT count() FROM bftest WHERE hasAny(x, [toDecimal32(123, 3), 2]) FORMAT Null; -- { serverError 53 } | ||
|
||
-- Bug discovered by AST fuzzier (fixed, shouldn't crash). | ||
SELECT 1 FROM bftest WHERE has(x, -0.) OR 0. FORMAT Null; | ||
SELECT count() FROM bftest WHERE hasAny(x, [0, 1]) OR 0. FORMAT Null; |