jonahgao opened a new pull request, #7405:
URL: https://github.com/apache/arrow-datafusion/pull/7405

   ## Which issue does this PR close?
   
   
   
   Closes #3849 
   Closes #4669 
   
   Now both `0 / 0` and `10 / 0` will result in the same `DivideByZero` error.
   ```shell
   DataFusion CLI v30.0.0
   ❯ select 0/0;
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Divide by zero error
   ❯ select 10/0;
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Divide by zero error
   
   ```
   ## Rationale for this change
   The const evaluator will first eliminate the expression `0 / 0` and raise a 
DivideByZero error.
   
https://github.com/apache/arrow-datafusion/blob/ea9144e6597593c09a4ef0b71a4da1cdfaca8249/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L129-L130
   And this rule will never have a match.
   
https://github.com/apache/arrow-datafusion/blob/ea9144e6597593c09a4ef0b71a4da1cdfaca8249/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L709-L715
   
   Furthermore, the behavior of this rule is inconsistent with the results of 
the following test case.
   
https://github.com/apache/arrow-datafusion/blob/ea9144e6597593c09a4ef0b71a4da1cdfaca8249/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L1666-L1675
   
   ## What changes are included in this PR?
   Remove an unreached simplification rule.
   
   ## Are these changes tested?
   N/A
   
   ## Are there any user-facing changes?
   No


-- 
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