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.
first_value/last_valueover aRANGEframe that uses a literalPRECEDING/FOLLOWINGoffset 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.