Skip to content

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

Description

@andygrove

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions