You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "jayshrivastava (via GitHub)" <gi...@apache.org> on 2026/03/19 18:55:10 UTC
[I] Dynamic filters sometimes do not get pushed down through aggregations [datafusion]
jayshrivastava opened a new issue, #21065:
URL: https://github.com/apache/datafusion/issues/21065
### Describe the bug
Consider this plan
```
HashJoinExec: on=[(bhandle@0, bhandle@0)] ← creates dynamic filter on bhandle@0
DataSourceExec (build)
AggregateExec: gby=[bhandle@1], aggr=[min] ← output: bhandle@0, min@1
ProjectionExec: [value@1, bhandle@0] ← reorders columns
DataSourceExec (probe) ← filter should be pushed down here but it's not
```
The dynamic filter does not get pushed down through the `AggregateExec` due to a mixup between input and output column indexes.
The issue happens due to the `ProjectionExec` reordering columns.
### To Reproduce
Tested on df 52.1.0
```
CREATE TABLE contexts (bhandle VARCHAR)
AS VALUES ('h1'), ('h2');
CREATE TABLE metrics (bhandle VARCHAR, ts TIMESTAMP, value DOUBLE)
AS VALUES
('h1', '2024-01-01T00:05:00', 1.0),
('h1', '2024-01-01T00:15:00', 2.0),
('h2', '2024-01-01T00:25:00', 3.0),
('h3', '2024-01-01T00:35:00', 4.0);
EXPLAIN VERBOSE SELECT * FROM contexts c
INNER JOIN (
SELECT bhandle, date_bin(interval '1 hour', ts) AS bucket, min(value) AS min_val
FROM (SELECT value, bhandle, ts FROM metrics)
GROUP BY bhandle, date_bin(interval '1 hour', ts)
) agg ON c.bhandle = agg.bhandle;
```
The output plan does not push down dynamic filters
```
HashJoinExec: mode=Auto, join_type=Inner, on=[(bhandle@0, bhandle@0)]
DataSourceExec: partitions=1
ProjectionExec: [bhandle@0, date_bin(1h, ts)@1 as bucket, min(value)@2 as min_val]
AggregateExec: mode=FinalPartitioned, gby=[bhandle@0, date_bin(1h, ts)@1], aggr=[min(value)]
AggregateExec: mode=Partial, gby=[bhandle@1, date_bin(1h, ts@2)], aggr=[min(value)]
ProjectionExec: [value@2, bhandle@0, ts@1] ← reorders columns
DataSourceExec: partitions=1
```
### 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] Dynamic filters sometimes do not get pushed down through aggregations [datafusion]
Posted by "jayshrivastava (via GitHub)" <gi...@apache.org>.
jayshrivastava commented on issue #21065:
URL: https://github.com/apache/datafusion/issues/21065#issuecomment-4092558756
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] Dynamic filters sometimes do not get pushed down through aggregations [datafusion]
Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb closed issue #21065: Dynamic filters sometimes do not get pushed down through aggregations
URL: https://github.com/apache/datafusion/issues/21065
--
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