NGA-TRAN opened a new pull request, #24500: URL: https://github.com/apache/datafusion/pull/24500
## Which issue does this PR close? - Related to #24438. - Follow-up issue will be filed after this lands (hash shuffle for `GROUP BY key, date_bin(timestamp)` on `Range([timestamp])`). ## Rationale for this change Adds a table that matches a common metrics layout: - columns `key, zone, host, pod, service, timestamp, value` - range-partitioned on `timestamp` into two 60-minute file groups - sorted within each file on `(key, timestamp)` and pins today's physical plan for: ```sql SELECT key, date_bin(INTERVAL '60 seconds', timestamp) AS time_bin, sum(value) FROM metrics_range_sorted WHERE service = 'a' GROUP BY key, time_bin ``` The scan already advertises `Range([timestamp])`, `output_ordering=[key, timestamp]`, and two parallel file groups. Time bins do not straddle the hour split, so `(key, time_bin)` is partition-disjoint. **Today DataFusion still inserts a hash `RepartitionExec` between Partial and Final**, even though `ordering_mode=Sorted` is already recognized. This PR documents that plan so a follow-up can remove the shuffle and the expected plan will shrink to a single `SinglePartitioned` aggregate. ## What changes are included in this PR? - Register `metrics_range_sorted` for sqllogictests. - EXPLAIN + result coverage for the filtered and unfiltered queries. ## Are these changes tested? This PR is tests only. ## Are there any user-facing changes? No. ## Test plan - [x] `cargo test --test sqllogictests -- range_sorted_time_bin_agg.slt` - [ ] CI sqllogictests Made with [Cursor](https://cursor.com) -- 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]
