-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Stalearea/sql/functionIssues or PRs related to the SQL functionsIssues or PRs related to the SQL functionshelp wanted
Description
Describe the bug
case 1:
mysql> select to_bitmap(null);
+-----------------+
| to_bitmap(NULL) |
+-----------------+
| NULL |
+-----------------+
1 row in set (0.01 sec)
It returns NULL because for null parameter, the function will return null. (directly rewrote by FE planner).
Case 2:
mysql> select bitmap_union_count(to_bitmap(k2)) from tbl5;
+-------------------------------------+
| bitmap_union_count(to_bitmap(`k2`)) |
+-------------------------------------+
| 0 |
+-------------------------------------+
1 row in set (0.02 sec)
The column k2 in tbl5 is null. And to_bitmap(k2) return an empty bitmap.
Case 3:
mysql> select bitmap_union_count(to_bimap(null)) from tbl5;
ERROR 1064 (HY000): errCode = 2, detailMessage = No matching function with signature: to_bimap(unknown type: NULL_TYPE).
I expected this return 0, but error returns.
Expected behavior
Should the method to_bitmap() be null protected? Which means to_bitmap(null) should always return an empty bitmap, not null.
Metadata
Metadata
Assignees
Labels
Stalearea/sql/functionIssues or PRs related to the SQL functionsIssues or PRs related to the SQL functionshelp wanted