-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lead and Lag window functions should support default value with datatype other than Int64 #9001
Conversation
…type other than Int64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me -- thanks @viirya
cc @mustafasrepo and @comphead
@@ -2364,6 +2364,16 @@ impl ScalarValue { | |||
ScalarValue::try_from_array(&cast_arr, 0) | |||
} | |||
|
|||
/// Try to cast this value to a ScalarValue of type `data_type` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks! I think this is the fix to #8307, so you can use that issue number in the PR description. |
@@ -2364,6 +2364,16 @@ impl ScalarValue { | |||
ScalarValue::try_from_array(&cast_arr, 0) | |||
} | |||
|
|||
/// Try to cast this value to a ScalarValue of type `data_type` | |||
pub fn cast_to(&self, data_type: &DataType) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was introducing the same method to overcome unnecessary string conversion in separate PR 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thank you @alamb @mustafasrepo @simonvandel @comphead |
Which issue does this PR close?
Closes #8307.
Rationale for this change
Noticed this when reviewing #8989. Currently we only support default value with Int64 data type for Lead and Lag window functions. This patch enables other data types to be used as default value.
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?