-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FLASH-948 fix udaf behavior for empty input (#481)
* udafs other than count should return NULL if input is empty * fix bugs * fix bug * add tests * address comment * enhance tests Co-authored-by: ruoxi <[email protected]>
- Loading branch information
1 parent
afcec7f
commit 15b2183
Showing
6 changed files
with
111 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
mysql> drop table if exists test.t | ||
mysql> create table test.t(a int not null, b int, c int, d int, e int, f int) | ||
mysql> alter table test.t set tiflash replica 1 location labels 'rack', 'host', 'abc' | ||
|
||
SLEEP 15 | ||
|
||
mysql> insert into test.t values (1, 1, 1, 1, 1, 1); | ||
mysql> insert into test.t values (1, 2, 3, NULL, NULL, 1); | ||
|
||
SLEEP 15 | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ count(1),count(a),count(b),count(d),count(NULL) from test.t where a > 10; | ||
+----------+----------+----------+----------+-------------+ | ||
| count(1) | count(a) | count(b) | count(d) | count(NULL) | | ||
+----------+----------+----------+----------+-------------+ | ||
| 0 | 0 | 0 | 0 | 0 | | ||
+----------+----------+----------+----------+-------------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ count(1),count(a),count(b),count(d),count(NULL) from test.t where a <= 10; | ||
+----------+----------+----------+----------+-------------+ | ||
| count(1) | count(a) | count(b) | count(d) | count(NULL) | | ||
+----------+----------+----------+----------+-------------+ | ||
| 2 | 2 | 2 | 1 | 0 | | ||
+----------+----------+----------+----------+-------------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ sum(1),sum(a),sum(b),sum(d),sum(NULL) from test.t where a > 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| sum(1) | sum(a) | sum(b) | sum(d) | sum(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| NULL | NULL | NULL | NULL | NULL | | ||
+--------+--------+--------+--------+-----------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ sum(1),sum(a),sum(b),sum(d),sum(NULL) from test.t where a <= 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| sum(1) | sum(a) | sum(b) | sum(d) | sum(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| 2 | 2 | 3 | 1 | NULL | | ||
+--------+--------+--------+--------+-----------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ min(1),min(a),min(b),min(d),min(NULL) from test.t where a > 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| min(1) | min(a) | min(b) | min(d) | min(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| NULL | NULL | NULL | NULL | NULL | | ||
+--------+--------+--------+--------+-----------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ min(1),min(a),min(b),min(d),min(NULL) from test.t where a <= 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| min(1) | min(a) | min(b) | min(d) | min(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| 1 | 1 | 1 | 1 | NULL | | ||
+--------+--------+--------+--------+-----------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ max(1),max(a),max(b),max(d),max(NULL) from test.t where a > 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| max(1) | max(a) | max(b) | max(d) | max(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| NULL | NULL | NULL | NULL | NULL | | ||
+--------+--------+--------+--------+-----------+ | ||
|
||
mysql> select /*+ read_from_storage(tiflash[t]) */ max(1),max(a),max(b),max(d),max(NULL) from test.t where a <= 10; | ||
+--------+--------+--------+--------+-----------+ | ||
| max(1) | max(a) | max(b) | max(d) | max(NULL) | | ||
+--------+--------+--------+--------+-----------+ | ||
| 1 | 1 | 2 | 1 | NULL | | ||
+--------+--------+--------+--------+-----------+ |