apache / apache/datafusion-comet

Support FIRST_VALUE/LAST_VALUE on a RANGE window frame with a literal offset

Open
#4,835 2 comments 3 reactions 1 assignee Claimed by @comphead View on GitHub
area:expressions enhancement
Dominant language
Scala
Stars
1.3k
Forks
373
Avg merge
2d 6h
Merged PRs (30d)
190

Description

`first_value` / `last_value` over a `RANGE` frame that uses a literal `PRECEDING`/`FOLLOWING` offset fall back to Spark today.

See `spark/src/main/scala/org/apache/spark/sql/comet/CometWindowExec.scala` (around lines 404-420), which records "FIRST_VALUE with RANGE frame and literal offset is not supported" / "LAST_VALUE with RANGE frame and literal offset is not supported".

Comet's stateless native RANGE frame cannot reproduce Spark's monotonic lower-bound iterator semantics under non-ANSI overflow, so it falls back rather than risk an incorrect result.

Documented as a current limitation in the window function compatibility guide.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.