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 #50017 from ClickHouse/backport/22.8/43311
Backport 43311 to 22.8
- Loading branch information
Showing
6 changed files
with
133 additions
and
8 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
28 changes: 28 additions & 0 deletions
28
tests/queries/0_stateless/02481_low_cardinality_with_short_circuit_functins.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,28 @@ | ||
if with one LC argument | ||
b | ||
a | ||
b | ||
b | ||
a | ||
b | ||
a | ||
if with LC and NULL arguments | ||
\N | ||
a | ||
\N | ||
\N | ||
a | ||
\N | ||
a | ||
if with two LC arguments | ||
b | ||
a | ||
b | ||
b | ||
a | ||
a | ||
a | ||
\N | ||
1 | ||
1 | ||
1 |
26 changes: 26 additions & 0 deletions
26
tests/queries/0_stateless/02481_low_cardinality_with_short_circuit_functins.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,26 @@ | ||
set short_circuit_function_evaluation='force_enable'; | ||
|
||
select 'if with one LC argument'; | ||
select if(0, toLowCardinality('a'), 'b'); | ||
select if(1, toLowCardinality('a'), 'b'); | ||
select if(materialize(0), materialize(toLowCardinality('a')), materialize('b')); | ||
select if(number % 2, toLowCardinality('a'), 'b') from numbers(2); | ||
select if(number % 2, materialize(toLowCardinality('a')), materialize('b')) from numbers(2); | ||
|
||
select 'if with LC and NULL arguments'; | ||
select if(0, toLowCardinality('a'), NULL); | ||
select if(1, toLowCardinality('a'), NULL); | ||
select if(materialize(0), materialize(toLowCardinality('a')), NULL); | ||
select if(number % 2, toLowCardinality('a'), NULL) from numbers(2); | ||
select if(number % 2, materialize(toLowCardinality('a')), NULL) from numbers(2); | ||
|
||
select 'if with two LC arguments'; | ||
select if(0, toLowCardinality('a'), toLowCardinality('b')); | ||
select if(1, toLowCardinality('a'), toLowCardinality('b')); | ||
select if(materialize(0), materialize(toLowCardinality('a')), materialize(toLowCardinality('b'))); | ||
select if(number % 2, toLowCardinality('a'), toLowCardinality('b')) from numbers(2); | ||
select if(number % 2, materialize(toLowCardinality('a')), materialize(toLowCardinality('a'))) from numbers(2); | ||
|
||
select if(number % 2, toLowCardinality(number), NULL) from numbers(2); | ||
select if(number % 2, toLowCardinality(number), toLowCardinality(number + 1)) from numbers(2); | ||
|