You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "LiaCastaneda (via GitHub)" <gi...@apache.org> on 2025/09/11 17:15:49 UTC

[I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

LiaCastaneda opened a new issue, #17527:
URL: https://github.com/apache/datafusion/issues/17527

   ### Describe the bug
   
   Just a follow up to [this](https://github.com/apache/datafusion/issues/17486#issuecomment-3271707155) comment. 
   
   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, set a flag on HashJoinExec to build the bounds accumulator, otherwise, skip bounds computation entirely.
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3289533955

   That is something like https://github.com/apache/datafusion/pull/17370


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "LiaCastaneda (via GitHub)" <gi...@apache.org>.
LiaCastaneda commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3580150684

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "LiaCastaneda (via GitHub)" <gi...@apache.org>.
LiaCastaneda commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3289479494

   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


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "LiaCastaneda (via GitHub)" <gi...@apache.org>.
LiaCastaneda commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3284262157

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


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "rkrishn7 (via GitHub)" <gi...@apache.org>.
rkrishn7 commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3282913873

   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
   ```
   cc @adriangb 
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3576945224

   In https://github.com/apache/datafusion/pull/18644#discussion_r2548545616 it was proposed to add an `is_used` function that uses the Arc reference count.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3283197784

   > 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
   > ```
   > cc @adriangb 
   > 
   
   Yep that's the case. We'd either have to expand the pushdown result enum to three cases:
   - Exact
   - Inexact
   - Unsupported
   
   Or build in some notion of "subscribers" to dynamic filters where the thing that's going to use them has to "subscribe".


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3285593615

   I think the pro of the subscriber option is:
   1. Like you say it can be applied to only some filters and not others.
   2. It avoids making the general filter pushdown API more complex (although the complexity gets pushed somewhere else).


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb commented on issue #17527:
URL: https://github.com/apache/datafusion/issues/17527#issuecomment-3289506911

   That could be a good opportunity to broadcast updates


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Only compute bounds/ dynamic filters if consumer asks for it [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb closed issue #17527: Only compute bounds/ dynamic filters if consumer asks for it
URL: https://github.com/apache/datafusion/issues/17527


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org