adriangb commented on code in PR #12606:
URL: https://github.com/apache/datafusion/pull/12606#discussion_r1773696491


##########
datafusion/core/src/physical_optimizer/pruning.rs:
##########
@@ -478,6 +478,31 @@ pub struct PruningPredicate {
     literal_guarantees: Vec<LiteralGuarantee>,
 }
 
+/// Hook to handle predicates that DataFusion can not handle, e.g. certain 
complex expressions
+/// or predicates that reference columns that are not in the schema.
+pub trait UnhandledPredicateHook {
+    /// Called when a predicate can not be handled by DataFusion's 
transformation rules
+    /// or is referencing a column that is not in the schema.
+    fn handle(&self, expr: &Arc<dyn PhysicalExpr>) -> Arc<dyn PhysicalExpr>;
+}

Review Comment:
   This could be a closure but I had issues with lifetimes, etc. Having the 
trait also gives it a useful name 😄 
   
   The other API questions are:
   - Should this be mutable? I think implementers can just use interior 
mutability if needed.
   - Should this make it easier to say "use the existing expression"? I don't 
think that's a common case, and the current APIs use `&Arc<dyn PhysicalExpr> -> 
Arc<dyn PhysicalExpr>` as well. Plus it's as easy as a Clone on an Arc.



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