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


##########
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>;
+}
+
+#[derive(Debug, Clone)]
+struct ConstantUnhandledPredicateHook {
+    default: Arc<dyn PhysicalExpr>,
+}
+
+impl ConstantUnhandledPredicateHook {
+    fn new(default: Arc<dyn PhysicalExpr>) -> Self {
+        Self { default }
+    }
+}
+
+impl UnhandledPredicateHook for ConstantUnhandledPredicateHook {
+    fn handle(&self, _expr: &Arc<dyn PhysicalExpr>) -> Arc<dyn PhysicalExpr> {
+        self.default.clone()
+    }
+}

Review Comment:
   No strong feelings for naming these, I don't love the current names.



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