-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
From this changes, I find some inconsistent behavior for `divide` about `zero`.
❯ \d left
+---------------+--------------+------------+-------------+-----------+-------------+
| table_catalog | table_schema | table_name | column_name | data_type | is_nullable |
+---------------+--------------+------------+-------------+-----------+-------------+
| datafusion | public | left | c | Int32 | YES |
+---------------+--------------+------------+-------------+-----------+-------------+
1 row in set. Query took 0.054 seconds.
❯ select c/0 from left;
ArrowError(DivideByZero)
❯ select 10/0;
+----------------------+
| Int64(10) / Int64(0) |
+----------------------+
| |
+----------------------+
The difference is from the arrow-rs kernel divide_scalar and divide_opt.
In the divide_scalar, it will check the zero for the right, but in the divide_opt, the result will be replaced with NULL if the right value is zero.
cc @alamb
Originally posted by @liukun4515 in #4648 (comment)
Metadata
Metadata
Assignees
Labels
No labels