HaoYang670 commented on code in PR #3627:
URL: https://github.com/apache/arrow-datafusion/pull/3627#discussion_r982103650
##########
datafusion/optimizer/src/simplify_expressions.rs:
##########
@@ -110,6 +110,22 @@ fn expr_contains(expr: &Expr, needle: &Expr, search_op:
Operator) -> bool {
}
}
+fn is_zero(s: &Expr) -> bool {
+ match s {
+ Expr::Literal(ScalarValue::Int8(Some(0)))
+ | Expr::Literal(ScalarValue::Int16(Some(0)))
+ | Expr::Literal(ScalarValue::Int32(Some(0)))
+ | Expr::Literal(ScalarValue::Int64(Some(0)))
+ | Expr::Literal(ScalarValue::UInt8(Some(0)))
+ | Expr::Literal(ScalarValue::UInt16(Some(0)))
+ | Expr::Literal(ScalarValue::UInt32(Some(0)))
+ | Expr::Literal(ScalarValue::UInt64(Some(0))) => true,
+ Expr::Literal(ScalarValue::Float32(Some(v))) if *v == 0. => true,
+ Expr::Literal(ScalarValue::Float64(Some(v))) if *v == 0. => true,
+ _ => false,
Review Comment:
We could create a follow-up ticket to add Decimal.
--
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]