Skip to content

fix(sql): fix NullPointerException in lead() window function when using bind variables#6264

Merged
bluestreak01 merged 6 commits intomasterfrom
nw_lead_bind_var_fix
Oct 13, 2025
Merged

fix(sql): fix NullPointerException in lead() window function when using bind variables#6264
bluestreak01 merged 6 commits intomasterfrom
nw_lead_bind_var_fix

Conversation

@nwoolmer
Copy link
Copy Markdown
Contributor

@nwoolmer nwoolmer commented Oct 10, 2025

The lead window function has three parameters, the third of which is a default placeholder value. From docs:

lead(value [, offset [, default]]) [(IGNORE|RESPECT) NULLS]
OVER ([PARTITION BY partition_expression] [ORDER BY sort_expression])

When using a bind variable in this position, i.e. lead(value, 1, ?), the value was not initialised correctly, leading to null reference exceptions upon its use.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nw_lead_bind_var_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nwoolmer nwoolmer changed the title fix(sql): defaultValue bind variable not being initialised correctly in lead window function fix(sql): fix NullPointerException in lead() window function when using bind variables Oct 10, 2025
@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 21 / 21 (100.00%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/functions/window/LeadLagWindowFunctionFactoryHelper.java 21 21 100.00%

@nwoolmer nwoolmer requested a review from kafka1991 October 13, 2025 13:31
Copy link
Copy Markdown
Collaborator

@kafka1991 kafka1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nwoolmer
Copy link
Copy Markdown
Contributor Author

Thanks for the review!

@bluestreak01 bluestreak01 merged commit fb27a5d into master Oct 13, 2025
35 checks passed
@bluestreak01 bluestreak01 deleted the nw_lead_bind_var_fix branch October 13, 2025 23:13
jerrinot pushed a commit that referenced this pull request Oct 24, 2025
…ng bind variables [BACKPORT]

backport of #6264
(cherry picked from commit fb27a5d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants