You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/28 21:29:46 UTC

[GitHub] [arrow-datafusion] tustvold opened a new issue, #6791: Inconsistent Divide By Zero Behaviour

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold closed issue #6791: Inconsistent Divide By Zero Behaviour

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #6791: Inconsistent Divide By Zero Behaviour 
URL: https://github.com/apache/arrow-datafusion/issues/6791


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org