You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "duongcongtoai (via GitHub)" <gi...@apache.org> on 2025/05/25 15:26:52 UTC

Re: [PR] feat: Support parsing subqueries with `OuterReferenceColumn` belongs to non-adjacent outer relation [datafusion]

duongcongtoai commented on code in PR #16186:
URL: https://github.com/apache/datafusion/pull/16186#discussion_r2106233488


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -1089,7 +1089,11 @@ impl OptimizerRule for PushDownFilter {
                 let (volatile_filters, non_volatile_filters): (Vec<&Expr>, Vec<&Expr>) =
                     filter_predicates
                         .into_iter()
-                        .partition(|pred| pred.is_volatile());
+                        // TODO: subquery decorrelation sometimes cannot decorrelated all the expr
+                        // (i.e in the case of recursive subquery)
+                        // this function may accidentally pushdown the subquery expr as well
+                        // until then, we have to exclude these exprs here
+                        .partition(|pred| pred.is_volatile() || has_subquery(pred));

Review Comment:
   this is to satisfy the new test added in subquery.slt, else the predicate containing the scalar subquery will be accidentally pushed down and cause planning error



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org