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


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -1089,7 +1089,13 @@ 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_scalar_subquery(pred)

Review Comment:
   when we allow nested subquery, the final plan reaches this optimizor and the 
predicate on scalar_subquery can be accidentally push down



-- 
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-unsubscr...@datafusion.apache.org

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


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

Reply via email to