Skip to content

Apache DataFusion SQL Query Engine

Minor: Remove the unreached simplification rule for `0 / 0` (#7405)

Jonah Gao193cdcf8d5e6
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();