gene-bordegaray commented on code in PR #20246:
URL: https://github.com/apache/datafusion/pull/20246#discussion_r2801138609


##########
datafusion/physical-expr/src/expressions/dynamic_filters.rs:
##########
@@ -450,6 +524,25 @@ impl PhysicalExpr for DynamicFilterPhysicalExpr {
     }
 }
 
+/// Snapshot a `PhysicalExpr` tree, replacing any 
[`DynamicFilterPhysicalExpr`] that
+/// has per-partition data with its partition-specific filter expression.
+/// If a `DynamicFilterPhysicalExpr` does not have partitioned data, it is 
left unchanged.
+pub fn snapshot_physical_expr_for_partition(
+    expr: Arc<dyn PhysicalExpr>,
+    partition: usize,
+) -> Result<Arc<dyn PhysicalExpr>> {
+    expr.transform_up(|e| {
+        if let Some(dynamic) = 
e.as_any().downcast_ref::<DynamicFilterPhysicalExpr>()
+            && dynamic.has_partitioned_filters()
+        {
+            let snapshot = dynamic.current_for_partition(partition)?;
+            return Ok(Transformed::yes(snapshot));

Review Comment:
   Ok, I think a github comment and a integration test will be good. I want to 
check the filter itself and the mode that got selected in this case



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