-
Notifications
You must be signed in to change notification settings - Fork 1.8k
bug: Support null as argument to to_local_time #17491
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
Conversation
| match time_value { | ||
| Timestamp(timeunit, _) => Ok(Timestamp(*timeunit, None)), | ||
| DataType::Null => Ok(Timestamp(Nanosecond, None)), |
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'm following the same behavior as date_trunc.rs here: returning a Nanosecond Timestamp datatype for nulls.
datafusion/datafusion/functions/src/datetime/date_trunc.rs
Lines 150 to 154 in fc5888b
| fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { | |
| match &arg_types[1] { | |
| Timestamp(Nanosecond, None) | Utf8 | DataType::Date32 | Null => { | |
| Ok(Timestamp(Nanosecond, None)) | |
| } |
alamb
left a comment
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.
😍 🏃
Thank you so much @petern48
|
FYI @2010YOUY01 |
because to_local_time impls coerce_types, the Null argument gets coerced
|
Merged, thanks! |
Which issue does this PR close?
to_local_time()function (SQLancer) #17472Rationale for this change
See issue.
What changes are included in this PR?
Add support for null argument to to_local_time function
Are these changes tested?
Added both scalar and array tests
Are there any user-facing changes?
Yes