neilconway opened a new issue, #21324:
URL: https://github.com/apache/datafusion/issues/21324

   ### Describe the bug
   
   Example query (TPC-H Q22):
   
   ```sql
     SELECT ... FROM customer
     WHERE c_acctbal > (SELECT avg(c_acctbal) FROM customer WHERE ...)
   ```
   
   It would be good to push the predicate down to the scan on `customer`.
   
   The problem with doing this now is that `filter_partitions` calls 
`create_physical_expr` with a fresh `ExecutionProps`, so we don't have a way to 
pass the `ScalarSubqueryResults` to any `ScalarSubqueryExpr` nodes in the 
filter expression. This should be fixable in theory.
   
   We'd also need to update `extract_dml_filters` to apply subquery filters.
   
   This is distinct from using subquery filters for partition pruning, which 
would be more difficult (we'd need to evaluate the subquery at planning-time).
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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]

Reply via email to