eejbyfeldt commented on code in PR #13249:
URL: https://github.com/apache/datafusion/pull/13249#discussion_r1834439966
##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -1675,12 +1675,34 @@ impl<'a, S: SimplifyInfo> TreeNodeRewriter for
Simplifier<'a, S> {
}
}
+ // null <op> A --> null,
+ Expr::BinaryExpr(BinaryExpr {
+ left,
+ op: Eq | NotEq | Gt | GtEq | Lt | LtEq,
+ right: _,
+ }) if always_null(&left, info) =>
Transformed::yes(lit_bool_null()),
+
+ // A <op> null --> null,
+ Expr::BinaryExpr(BinaryExpr {
+ left: _,
+ op: Eq | NotEq | Gt | GtEq | Lt | LtEq,
+ right,
+ }) if always_null(&right, info) =>
Transformed::yes(lit_bool_null()),
+
// no additional rewrites possible
expr => Transformed::no(expr),
})
}
}
+fn always_null<S: SimplifyInfo>(expr: &Expr, info: &S) -> bool {
+ is_null(expr)
Review Comment:
Do we actually need that distinction? Or could we make all current usage of
`is_null` use `always_null`?
If that is the case it seems like we should just improve `is_null` instead.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]