You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Only compute bounds/ dynamic filters if consumer asks for it #17527
Currently, DataFusion computes bounds for all queries that contain a HashJoinExec node whenever the option enable_dynamic_filter_pushdown is set to true (default). It might make sense to compute these bounds only when we explicitly know there is a consumer that will use them.
One way to achieve this could be during physical planning: while traversing the plan, check whether there is any scan/leaf node that is “interested in” or supports dynamic filters (determined by gather_filters_for_pushdown). This might just require adding some logic to the filter pushdown optimization rule itself I think?
Then, only if there is at least one interested consumer that accepts the DynamicFilterPhysicalExpr, set a flag on HashJoinExec to build the bounds accumulator, otherwise, skip bounds computation entirely.
I think this is intentionally not handled in handle_child_pushdown_result 🤔
// Note that we don't check PushdDownPredicate::discrimnant because even if nothing said
// "yes, I can fully evaluate this filter" things might still use it for statistics -> it's worth updating
I think this is intentionally not handled in handle_child_pushdown_result 🤔
// Note that we don't check PushdDownPredicate::discrimnant because even if nothing said
// "yes, I can fully evaluate this filter" things might still use it for statistics -> it's worth updating
Yep that's the case. For example Parquet may not be able to fully evaluate the filter for each row but may still be able to use it for file level and row group stats pruning.
I think we have two options:
Expand the pushdown result enum from two yes/no cases to three cases: exact (parent can drop the filter), inexact (parent should still apply the filter but it may be referenced for stats/partial pruning) and unsupported (the filter is not going to be used at all).
Build in some notion of "subscribers" to dynamic filters where the thing that's going to use them has to "subscribe".
Yep that's the case. For example Parquet may not be able to fully evaluate the filter for each row but may still be able to use it for file level and row group stats pruning.
Ah, I didn't acocunt for that
Expand the pushdown result enum from two yes/no cases to three cases: exact (parent can drop the filter), inexact (parent should still apply the filter but it may be referenced for stats/partial pruning) and unsupported (the filter is not going to be used at all).
maybe we could start with this? although the subscriber option would still be interesting, especially now that we’re considering multiple filter types, a scan node could subscribe to just the type of filter it supports 🤔
I imagine the "subscribe" action would still be done by the consumer during optimization, and "publish" by has join during execution. If no one else is interested, I can take a stab at this one
Activity
rkrishn7 commentedon Sep 11, 2025
I think this is intentionally not handled in
handle_child_pushdown_result🤔cc @adriangb
adriangb commentedon Sep 12, 2025
Yep that's the case. For example Parquet may not be able to fully evaluate the filter for each row but may still be able to use it for file level and row group stats pruning.
I think we have two options:
LiaCastaneda commentedon Sep 12, 2025
Ah, I didn't acocunt for that
maybe we could start with this? although the subscriber option would still be interesting, especially now that we’re considering multiple filter types, a scan node could subscribe to just the type of filter it supports 🤔
adriangb commentedon Sep 12, 2025
I think the pro of the subscriber option is:
LiaCastaneda commentedon Sep 14, 2025
I imagine the "subscribe" action would still be done by the consumer during optimization, and "publish" by has join during execution. If no one else is interested, I can take a stab at this one
adriangb commentedon Sep 14, 2025
That could be a good opportunity to broadcast updates
adriangb commentedon Sep 14, 2025
That is something like #17370
adriangb commentedon Nov 25, 2025
In #18644 (comment) it was proposed to add an
is_usedfunction that uses the Arc reference count.LiaCastaneda commentedon Nov 26, 2025
take
Compute Dynamic Filters only when a consumer supports them (#19546)
fix: decide hash join dynamic filter production at planning time (apa…