tustvold opened a new issue, #6791: URL: https://github.com/apache/arrow-datafusion/issues/6791
### Describe the bug The behaviour when dividing by zero varies based on if the scalar or non-scalar version of the kernel is used ### To Reproduce Division by a zero scalar results in an error ``` ❯ create table foo as select 5 as v; ❯ select v / 0 from foo; Optimizer rule 'simplify_expressions' failed caused by Arrow error: Divide by zero error ``` Division by a zero array with a nullable column results in a null ``` ❯ CREATE TABLE bar(a int, b int) AS VALUES(5, 0),(NULL, NULL); ❯ select a / b from bar; +---------------+ | bar.a / bar.b | +---------------+ | | | | +---------------+ 2 rows in set. Query took 0.005 seconds. ``` And if the column is not nullable it results in a very peculiar error ``` ❯ create table bar as (select 5 as a, 0 as b); 0 rows in set. Query took 0.003 seconds. ❯ select a / b from bar; Arrow error: Invalid argument error: Column 'bar.a / bar.b' is declared as non-nullable but contains null values ``` ### Expected behavior We should consistently return a `DivideByZero` error on division by zero ### Additional context There is upstream work ongoing to improve arithmetic logic: - https://github.com/apache/arrow-rs/issues/2647 - https://github.com/apache/arrow-rs/issues/3999 -- 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]
