This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 193cdcf8d5 Minor: Remove the unreached simplification rule for `0 / 0`
(#7405)
193cdcf8d5 is described below
commit 193cdcf8d5e6b8d457115b53450ae541a4a00d4f
Author: Jonah Gao <[email protected]>
AuthorDate: Sat Aug 26 18:49:50 2023 +0800
Minor: Remove the unreached simplification rule for `0 / 0` (#7405)
* Minor: Remove the unreached simplification rule for `0/0`
* Fix comment in test case
---------
Co-authored-by: Andrew Lamb <[email protected]>
---
.../optimizer/src/simplify_expressions/expr_simplifier.rs | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
index c94d5e2e35..76073728b0 100644
--- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
+++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
@@ -705,14 +705,6 @@ impl<'a, S: SimplifyInfo> TreeNodeRewriter for
Simplifier<'a, S> {
op: Divide,
right,
}) if is_null(&right) => *right,
- // 0 / 0 -> null
- Expr::BinaryExpr(BinaryExpr {
- left,
- op: Divide,
- right,
- }) if is_zero(&left) && is_zero(&right) => {
- Expr::Literal(ScalarValue::Int32(None))
- }
// A / 0 -> DivideByZero Error
Expr::BinaryExpr(BinaryExpr {
left,
@@ -1664,7 +1656,7 @@ mod tests {
#[test]
fn test_simplify_divide_zero_by_zero() {
- // 0 / 0 -> null
+ // 0 / 0 -> DivideByZero
let expr = lit(0) / lit(0);
let err = try_simplify(expr).unwrap_err();