akupchinskiy opened a new pull request, #7813: URL: https://github.com/apache/datafusion-comet/pull/7813
## Which issue does this PR close? Closes #7812. ## Rationale for this change Spark accepts a frame whose lower bound lies after its upper bound when one side is `CURRENT ROW` (`ROWS BETWEEN CURRENT ROW AND 2 PRECEDING`, `ROWS BETWEEN 2 FOLLOWING AND CURRENT ROW`) and treats it as empty. Comet sends these frames to the native window operator, which gets a range with `start > end`. In a release build that returns a count of -1 and negated sums without an error, or fails the task, depending on the aggregate. Details and a repro are in the issue. A `NaN` RANGE offset has no sign and slips through the same way, so it is covered too. ## What changes are included in this PR? - `CometWindowExec`: fall back for a frame with `CURRENT ROW` on one side and an offset pointing past it (ROWS and RANGE), and for a `NaN` RANGE offset. - Native planner: refuse such frames with an error instead of running them, in case a plan gets there another way. - A line in the window section of `operators.md`. ## How are these changes tested? - `CometWindowExecSuite`: reversed frames over INT, DATE, DOUBLE and TIMESTAMP in ROWS and RANGE units fall back and match Spark; zero and infinite offsets stay native. - Rust planner test `window_frame_with_lower_bound_after_upper_bound`. Both fail on `main`. Generated-by: Claude Code (Claude Opus 5.5) I reviewed the change and ran the tests myself. -- 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]
