adriangb commented on code in PR #15301: URL: https://github.com/apache/datafusion/pull/15301#discussion_r2020156176
########## datafusion/physical-optimizer/src/pruning.rs: ########## @@ -527,6 +529,7 @@ impl PruningPredicate { /// See the struct level documentation on [`PruningPredicate`] for more /// details. pub fn try_new(expr: Arc<dyn PhysicalExpr>, schema: SchemaRef) -> Result<Self> { + let expr = snasphot_physical_expr(expr)?; Review Comment: This was the other piece of the trick: we need to snapshot here so that stats based pruning works. Because we do it in `PruningPredicate` even a custom `DataSourceExec`, `TableProvider` or anything else that uses `PruningPredicate` will benefit from dynamic filter pushdown (as long as it's not building the predicate too early). -- 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