Skip to content

[SPARK-56569] Add WINDOW_FUNCTION_FRAME_NOT_ORDERED error to replace _LEGACY_ERROR_TEMP_1037#55478

Closed
pnikic-db wants to merge 1 commit into
apache:masterfrom
pnikic-db:window-frame-not-ordered-error-condition
Closed

[SPARK-56569] Add WINDOW_FUNCTION_FRAME_NOT_ORDERED error to replace _LEGACY_ERROR_TEMP_1037#55478
pnikic-db wants to merge 1 commit into
apache:masterfrom
pnikic-db:window-frame-not-ordered-error-condition

Conversation

@pnikic-db
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

The error currently reported when an ORDER BY is not specified for a window function which requires it belongs in the _LEGACY_ERROR_TEMP group. These errors should be replaced with errors with proper error conditions.

In addition, the error text was improved, with the primary improvement being the removal of (value_expr). For example:

SELECT lead(t) OVER ()
FROM VALUES ('A'), ('B'), ('C') AS tbl(t)

Previous Error:

Window function lead(t#738680, 1, null) requires window to be ordered, please add ORDER BY clause. For example SELECT lead(t#738680, 1, null)(value_expr) OVER (PARTITION BY window_partition ORDER BY window_ordering) from table.

New Error:

[WINDOW_FUNCTION_FRAME_NOT_ORDERED] Window function lead requires the window to be ordered, please add an ORDER BY clause. For example: SELECT lead(tbl.t, 1, NULL) OVER (PARTITION BY window_partition ORDER BY window_ordering) FROM table. SQLSTATE: 42601

Why are the changes needed?

Improvement for error conditions.

Does this PR introduce any user-facing change?

The error message changed for when a window function requires and order by and none was provided.

How was this patch tested?

New tests were added and existing tests used to verify the new error class and the new format.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code 2.1.117

@pnikic-db pnikic-db force-pushed the window-frame-not-ordered-error-condition branch from 3daaf4f to fc2c3fd Compare April 22, 2026 10:57
@cloud-fan
Copy link
Copy Markdown
Contributor

the k8s failure is unrelated, thanks, merging to master!

@cloud-fan cloud-fan closed this in 438c880 Apr 23, 2026
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.

2 participants