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 #60586 from Avogar/fix-filter-virtual-columns
Fix reading from MergeTree with non-deterministic functions in filter
- Loading branch information
Showing
8 changed files
with
130 additions
and
0 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
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
11 changes: 11 additions & 0 deletions
11
.../0_stateless/03002_filter_skip_virtual_columns_with_non_deterministic_functions.reference
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,11 @@ | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
1 |
6 changes: 6 additions & 0 deletions
6
...ueries/0_stateless/03002_filter_skip_virtual_columns_with_non_deterministic_functions.sql
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,6 @@ | ||
create table test (number UInt64) engine=MergeTree order by number; | ||
insert into test select * from numbers(100000000); | ||
select ignore(number) from test where RAND() > 4292390314 limit 10; | ||
select count() > 0 from test where RAND() > 4292390314; | ||
drop table test; | ||
|
55 changes: 55 additions & 0 deletions
55
tests/queries/0_stateless/03008_filter_projections_non_deterministoc_functions.reference
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,55 @@ | ||
-- count | ||
100000 all_10_10_0 | ||
100000 all_1_1_0 | ||
100000 all_2_2_0 | ||
100000 all_3_3_0 | ||
100000 all_4_4_0 | ||
100000 all_5_5_0 | ||
100000 all_6_6_0 | ||
100000 all_7_7_0 | ||
100000 all_8_8_0 | ||
100000 all_9_9_0 | ||
-- rand()%2=0: | ||
1 all_10_10_0 | ||
1 all_1_1_0 | ||
1 all_2_2_0 | ||
1 all_3_3_0 | ||
1 all_4_4_0 | ||
1 all_5_5_0 | ||
1 all_6_6_0 | ||
1 all_7_7_0 | ||
1 all_8_8_0 | ||
1 all_9_9_0 | ||
-- optimize_use_implicit_projections=0 | ||
1 all_10_10_0 | ||
1 all_1_1_0 | ||
1 all_2_2_0 | ||
1 all_3_3_0 | ||
1 all_4_4_0 | ||
1 all_5_5_0 | ||
1 all_6_6_0 | ||
1 all_7_7_0 | ||
1 all_8_8_0 | ||
1 all_9_9_0 | ||
-- optimize_trivial_count_query=0 | ||
1 all_10_10_0 | ||
1 all_1_1_0 | ||
1 all_2_2_0 | ||
1 all_3_3_0 | ||
1 all_4_4_0 | ||
1 all_5_5_0 | ||
1 all_6_6_0 | ||
1 all_7_7_0 | ||
1 all_8_8_0 | ||
1 all_9_9_0 | ||
-- optimize_trivial_count_query=0, optimize_use_implicit_projections=0 | ||
1 all_10_10_0 | ||
1 all_1_1_0 | ||
1 all_2_2_0 | ||
1 all_3_3_0 | ||
1 all_4_4_0 | ||
1 all_5_5_0 | ||
1 all_6_6_0 | ||
1 all_7_7_0 | ||
1 all_8_8_0 | ||
1 all_9_9_0 |
28 changes: 28 additions & 0 deletions
28
tests/queries/0_stateless/03008_filter_projections_non_deterministoc_functions.sql
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,28 @@ | ||
create table test (number UInt64) engine=MergeTree order by number; | ||
system stop merges test; | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
INSERT INTO test select number from numbers(100000); | ||
|
||
select '-- count'; | ||
SELECT count(), _part FROM test GROUP BY _part ORDER BY _part; | ||
|
||
select '-- rand()%2=0:'; | ||
SELECT count() > 0 AND count() < 100000, _part FROM test WHERE rand(1)%2=1 GROUP BY _part ORDER BY _part; | ||
|
||
select '-- optimize_use_implicit_projections=0'; | ||
SELECT count() > 0 AND count() < 100000, _part FROM test WHERE rand(2)%2=1 GROUP BY _part ORDER BY _part settings optimize_use_implicit_projections=0; | ||
|
||
select '-- optimize_trivial_count_query=0'; | ||
SELECT count() > 0 AND count() < 100000, _part FROM test WHERE rand(3)%2=1 GROUP BY _part ORDER BY _part settings optimize_trivial_count_query=0; | ||
|
||
select '-- optimize_trivial_count_query=0, optimize_use_implicit_projections=0'; | ||
SELECT count() > 0 AND count() < 100000, _part FROM test WHERE rand(4)%2=1 GROUP BY _part ORDER BY _part settings optimize_trivial_count_query=0,optimize_use_implicit_projections=0; | ||
|