adriangb commented on code in PR #20337:
URL: https://github.com/apache/datafusion/pull/20337#discussion_r2804666999
##########
datafusion/core/tests/physical_optimizer/filter_pushdown.rs:
##########
@@ -3868,3 +3868,103 @@ async fn test_filter_with_projection_pushdown() {
];
assert_batches_eq!(expected, &result);
}
+
+/// Test that ExecutionPlan::expressions() can discover dynamic filters across
the plan tree
+#[tokio::test]
+async fn test_discover_dynamic_filters_via_expressions_api() {
+ use datafusion_common::JoinType;
+ use datafusion_physical_expr::expressions::DynamicFilterPhysicalExpr;
+ use datafusion_physical_plan::joins::{HashJoinExec, PartitionMode};
+
+ fn count_dynamic_filters(plan: &Arc<dyn ExecutionPlan>) -> usize {
+ let mut count = 0;
+
+ // Check expressions from this node
+ let exprs = plan.expressions();
+ for expr in exprs.iter() {
+ if let Some(_df) =
expr.as_any().downcast_ref::<DynamicFilterPhysicalExpr>() {
Review Comment:
Should this `expr.apply()` for nested expressions? Should it deduplicate
Arc'ed copies?
##########
datafusion/core/tests/physical_optimizer/filter_pushdown.rs:
##########
@@ -3868,3 +3868,103 @@ async fn test_filter_with_projection_pushdown() {
];
assert_batches_eq!(expected, &result);
}
+
+/// Test that ExecutionPlan::expressions() can discover dynamic filters across
the plan tree
+#[tokio::test]
+async fn test_discover_dynamic_filters_via_expressions_api() {
+ use datafusion_common::JoinType;
+ use datafusion_physical_expr::expressions::DynamicFilterPhysicalExpr;
+ use datafusion_physical_plan::joins::{HashJoinExec, PartitionMode};
+
+ fn count_dynamic_filters(plan: &Arc<dyn ExecutionPlan>) -> usize {
Review Comment:
This seems simple enough that I don't think it's worth poluting the API with
for now.
--
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]