feat: Enable expressions as default value in lead/lag function#22134
Draft
sandugood wants to merge 5 commits into
Draft
feat: Enable expressions as default value in lead/lag function#22134sandugood wants to merge 5 commits into
sandugood wants to merge 5 commits into
Conversation
comphead
reviewed
May 12, 2026
|
|
||
| assert_eq!(result, &expected); | ||
| Ok(()) | ||
| } |
Contributor
There was a problem hiding this comment.
please have tests in .slt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
ColumnExprin LAG/LEAD for default parameter #22082.Rationale for this change
In the current DataFusion implementation we can only use a
ScalarValueas the default value in bothLAGandLEADwindow functions. That means that users can't reference other columns' values from the table as default value and create various combinations of them.It means that currently we cannot perform something like:
lead(col1, 1, col1 / col2) as lead_resultWhat changes are included in this PR?
DefaultValueenum that can be either aLiteralvalue or anExpressionparse_default_valuefunction to takedefault_value's type into considerationshift_with_array_defaultandevaluate_all_with_ignore_null_and_array_defaultfor the situations, whendefault_valueis ofDefaultValue::ExpressiontypeAre these changes tested?
Yes, changes were tested:
lead_lag.rs./testssubdir.Are there any user-facing changes?
There are user-facing changes in terms of documentation and DataFusion usage (no syntax changes per se). Also, docs were updated