-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
date_trunc(null)
results in a panic
#6701
Comments
I'll look at it. |
I've tried to remove the unwrap() like specify in the issue, but nano is an Option, so removing the unwrap just creates errors. So is it better to catch the error and return null or replacing unwrap() by unwrap_or_default() which return "1970-01-01T00:00:00"? I got this timestamp by running this test in timestamps.slt query P SELECT DATE_TRUNC('minute', TIMESTAMP '2022-08-03 14:38:50Z'); ----2022-01-01T00:00:00
|
I think what is needed is to ignore nulls (so that null comes out) something like So rather than If you make a PR with some example code I can probably offer some more specific advice |
Describe the bug
Calling the
date_trunc(null)
function results in a panicTo Reproduce
Expected behavior
null
should be returnedAdditional context
Found while reviewing #6654 from @Weijun-H
The issue is the use of
unwrap()
in thedate_trunc
implementationI think this is a good first issue for someone as it is localized (involves removing
unwrap()
) and writing some tests using .sltThe text was updated successfully, but these errors were encountered: