adriangb commented on code in PR #19404:
URL: https://github.com/apache/datafusion/pull/19404#discussion_r2696875973
##########
datafusion/physical-plan/src/projection.rs:
##########
@@ -347,10 +371,30 @@ impl ExecutionPlan for ProjectionExec {
parent_filters: Vec<Arc<dyn PhysicalExpr>>,
_config: &ConfigOptions,
) -> Result<FilterDescription> {
- // TODO: In future, we can try to handle inverting aliases here.
- // For the time being, we pass through untransformed filters, so
filters on aliases are not handled.
- // https://github.com/apache/datafusion/issues/17246
- FilterDescription::from_children(parent_filters, &self.children())
+ // expand alias column to original expr in parent filters
+ let invert_alias_map = self.collect_reverse_alias()?;
+
+ let mut child_parent_filters =
Vec::with_capacity(parent_filters.len());
+
+ for filter in parent_filters {
+ let mut rewriter = PhysicalColumnRewriter::new(&invert_alias_map);
+ let rewritten = Arc::clone(&filter).rewrite(&mut rewriter)?.data;
+
+ if rewriter.has_unmapped_columns() {
+ // Filter contains columns that cannot be mapped through
projection
+ // Mark as unsupported - cannot push down
+
child_parent_filters.push(PushedDownPredicate::unsupported(filter));
Review Comment:
What would be a real world scenario where this is hit? Can this be
reproduced from SQL / SLT tests or only from unit tests?
--
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]