Skip to content

fix: Preserve NULL for zero-offset LEAD/LAG with IGNORE NULLS - #27313

Open
0xamlab wants to merge 1 commit into
apache:mainfrom
0xamlab:fix/lead-lag-zero-offset-ignore-nulls
Open

0xamlab wants to merge 1 commit into
apache:mainfrom
0xamlab:fix/lead-lag-zero-offset-ignore-nulls

Conversation

@0xamlab

@0xamlab 0xamlab commented Nov 10, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Offset zero selects the current row, so a NULL current value must remain NULL rather than produce the default.

What changes are included in this PR?

The fix aligns the stateful evaluator with evaluate_all_with_ignore_null for zero-offset LEAD/LAG.

What is the testing strategy for this PR?

The new regression covers LEAD and LAG, nonzero offsets, and batch evaluation, including NULL and non-NULL current rows with and without defaults.

All 9 window SQL logic test files passed. Workspace Clippy passed with -D warnings.

Are there any user-facing changes?

Zero-offset LEAD/LAG IGNORE NULLS now preserves a NULL current value.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LEAD/LAG with offset 0 and IGNORE NULLS returns the default for a NULL row, unlike the form without IGNORE NULLS

1 participant