fornwall opened a new pull request, #24515: URL: https://github.com/apache/datafusion/pull/24515
## Which issue does this PR close? - Closes apache/datafusion#24514. ## Rationale for this change Window functions ordered by `Time32` or `Time64` currently fail with an internal error, even when no frame clause is specified. `ORDER BY` defaults to `RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW`, whose free bounds only require comparisons, and time values are orderable. Finite `RANGE` offsets over time remain unsupported because time and interval arithmetic wraps around the 24-hour clock, so DataFusion's frame bound computation (`current_value ± offset`) cannot produce meaningful bounds. PostgreSQL supports such offsets through dedicated non-wrapping `in_range` logic, which is left as possible future work. ## What changes are included in this PR? - Treat `Time32` and `Time64` as comparison-only `RANGE` frame key types. - Continue rejecting finite `PRECEDING` and `FOLLOWING` offsets during planning. - Document time keys alongside other orderable, comparison-only types. ## Are these changes tested? Yes. SQL logic tests cover all four Arrow time units, duplicate peer values, dictionary-wrapped time keys, aggregate and ranking windows, ascending and descending order, explicit free bounds, and finite offsets on both bound sides. The full datafusion-sqllogictest suite and repository lint checks pass. ## Are there any user-facing changes? Yes. Free `RANGE` frames over `TIME` order keys now return results instead of an internal error. Finite offsets are still rejected, now with a clear planning error instead of the internal error. There are no public API or breaking changes. --- AI usage: Created with Claude Code and Opus 5. I have reviewed the code and made modifications where it made sense. -- 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]
