Skip to content

feat: native RANGE window frames with explicit offset on DATE ORDER BY#4974

Open
0lai0 wants to merge 5 commits into
apache:mainfrom
0lai0:feat-4834-range-offset-date-order-by
Open

feat: native RANGE window frames with explicit offset on DATE ORDER BY#4974
0lai0 wants to merge 5 commits into
apache:mainfrom
0lai0:feat-4834-range-offset-date-order-by

Conversation

@0lai0

@0lai0 0lai0 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Part of #4834 (DATE ORDER BY only; DECIMAL remains a follow-up)

Rationale for this change

Native windows used to fall back to Spark for RANGE frames with an explicit PRECEDING / FOLLOWING offset when ORDER BY was DATE. Spark ships that offset as an integer literal, but arrow-arith rejects Date32 + Int32 and requires an Interval RHS.
This PR coerces the offset to IntervalDayTime when the ORDER BY column is Date32, so boundary math uses Date32 + IntervalDayTime and the DATE fallback can be removed. UNBOUNDED / CURRENT ROW already ran natively; DECIMAL still falls back.

What changes are included in this PR?

  • Native planner : coerce Int32 / Int64 RANGE offsets to IntervalDayTime for Date32 ORDER BY.
  • Scala serde : drop the DateType RANGE fallback; keep the DECIMAL fallback.
  • Tests : 7 cases in CometWindowExecSuite (offsets, duplicate dates, nulls, unbounded baseline).

How are these changes tested?

./mvnw test -Dtest=none -Dsuites="org.apache.comet.exec.CometWindowExecSuite"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant