You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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 think what is needed is to ignore nulls (so that null comes out)
something like nano.map(|nano| truncate(nano))
So rather than unwrap use map to only do the calculation of nano is non null
If you make a PR with some example code I can probably offer some more specific advice
Activity
BryanEmond commentedon Jun 16, 2023
I'll look at it.
BryanEmond commentedon Jun 16, 2023
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
error:
[SQL] SELECT DATE_TRUNC('minute', NULL);
[Diff] (-expected|+actual)
at tests/sqllogictests/test_files/timestamps.slt:910
alamb commentedon Jun 18, 2023
I think what is needed is to ignore nulls (so that null comes out)
something like
nano.map(|nano| truncate(nano))So rather than
unwrapusemapto only do the calculation ofnanois non nullIf you make a PR with some example code I can probably offer some more specific advice