forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 1
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 ClickHouse#65519 from KevinyhZou/Fix_least_greast_…
…diff Make functions `least` and `greatest` ignore NULL arguments
- Loading branch information
Showing
6 changed files
with
75 additions
and
28 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,9 +5,9 @@ z | |
hello | ||
world | ||
1 | ||
\N | ||
\N | ||
nan | ||
1 | ||
inf | ||
inf | ||
inf | ||
-0 | ||
123 | ||
|
@@ -20,4 +20,4 @@ inf | |
[] | ||
[NULL] | ||
[0] | ||
[NULL] | ||
[0] |
21 changes: 21 additions & 0 deletions
21
tests/queries/0_stateless/03174_least_greatest_ignore_null_input_values.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,21 @@ | ||
Test with one const argument | ||
\N \N | ||
Test with two const arguments | ||
1 1 | ||
1 1 | ||
1.1 1.1 | ||
1.1 1.1 | ||
a a | ||
a a | ||
Test with one non-const argument | ||
\N \N | ||
Test with two non-const arguments | ||
1 1 | ||
1 1 | ||
1.1 1.1 | ||
1.1 1.1 | ||
a a | ||
a a | ||
Special cases | ||
2 1 | ||
1 1 |
27 changes: 27 additions & 0 deletions
27
tests/queries/0_stateless/03174_least_greatest_ignore_null_input_values.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,27 @@ | ||
-- Tests functions "greatest" and "least" with NULL arguments | ||
|
||
SELECT 'Test with one const argument'; | ||
SELECT greatest(NULL), least(NULL); | ||
|
||
SELECT 'Test with two const arguments'; | ||
SELECT greatest(1, NULL), least(1, NULL); | ||
SELECT greatest(NULL, 1), least(NULL, 1); | ||
SELECT greatest(NULL, 1.1), least(NULL, 1.1); | ||
SELECT greatest(1.1, NULL), least(1.1, NULL); | ||
SELECT greatest(NULL, 'a'), least(NULL, 'a'); | ||
SELECT greatest('a', NULL), least('a', NULL); | ||
|
||
SELECT 'Test with one non-const argument'; | ||
SELECT greatest(materialize(NULL)), least(materialize(NULL)); | ||
|
||
SELECT 'Test with two non-const arguments'; | ||
SELECT greatest(materialize(1), NULL), least(materialize(1), NULL); | ||
SELECT greatest(materialize(NULL), 1), least(materialize(NULL), 1); | ||
SELECT greatest(materialize(NULL), 1.1), least(materialize(NULL), 1.1); | ||
SELECT greatest(materialize(1.1), NULL), least(materialize(1.1), NULL); | ||
SELECT greatest(materialize(NULL), 'a'), least(materialize(NULL), 'a'); | ||
SELECT greatest(materialize('a'), NULL), least(materialize('a'), NULL); | ||
|
||
SELECT 'Special cases'; | ||
SELECT greatest(toNullable(1), 2), least(toNullable(1), 2); | ||
SELECT greatest(toLowCardinality(1), NULL), least(toLowCardinality(1), NULL); |