adriangb commented on code in PR #18938:
URL: https://github.com/apache/datafusion/pull/18938#discussion_r2564582722
##########
datafusion/physical-expr/src/expressions/dynamic_filters.rs:
##########
@@ -294,6 +294,16 @@ impl DynamicFilterPhysicalExpr {
.await;
}
+ /// Check if this dynamic filter is being actively used by any consumers.
+ ///
+ /// Returns `true` if there are references beyond the producer (e.g., the
HashJoinExec
+ /// that created the filter). This is useful to avoid computing expensive
filter
+ /// expressions when no consumer will actually use them.
+ pub fn is_used(self: &Arc<Self>) -> bool {
+ // Strong count > 1 means at least one consumer is holding a reference
beyond the producer.
+ Arc::strong_count(self) > 1
+ }
Review Comment:
Can’t you just make a new DynamicFilterPhysicalExpr and check that is_used
is False?
--
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]