kumarUjjawal commented on code in PR #26042:
URL: https://github.com/apache/datafusion/pull/26042#discussion_r4356729815
##########
datafusion/physical-expr/src/equivalence/class.rs:
##########
@@ -902,6 +970,34 @@ impl EquivalenceGroup {
}
}
+/// Whether an expression tree references any input column.
+fn contains_column_reference(expr: &PhysicalExprRef) -> bool {
+ if expr.downcast_ref::<Column>().is_some() {
+ return true;
+ }
+ let children = expr.children();
+ if children.is_empty() {
+ return expr.downcast_ref::<Literal>().is_none();
+ }
+ children.into_iter().any(contains_column_reference)
+}
+
+/// Replace input columns with NULL without evaluating the expression.
+fn null_extended_expr(expr: &PhysicalExprRef) -> Option<PhysicalExprRef> {
+ if expr.downcast_ref::<Column>().is_some() {
+ return Some(Arc::new(Literal::new(ScalarValue::Null)));
Review Comment:
Could we preserve the type information, or drop these expressions when we
cannot prove they remain equal? A regression test with a type-sensitive UDF
would help cover this case.
--
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]