liukun4515 opened a new issue, #4669:
URL: https://github.com/apache/arrow-datafusion/issues/4669

           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 
https://github.com/apache/arrow-datafusion/issues/4648#issuecomment-1354183892_
         


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to