-
Notifications
You must be signed in to change notification settings - Fork 62
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
Implements date_add builtin in partiql-eval #1334
Conversation
Conformance comparison report
Number passing in both: 5384 Number failing in both: 434 Number passing in Base (c5dae43) but now fail: 0 Number failing in Base (c5dae43) but now pass: 0 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## partiql-plugin-impl #1334 +/- ##
======================================================
Coverage ? 49.27%
Complexity ? 1046
======================================================
Files ? 166
Lines ? 13395
Branches ? 2504
======================================================
Hits ? 6600
Misses ? 6138
Partials ? 657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
val interval = args[0].check<Int32Value>() | ||
val datetime = args[1].check<DateValue>() | ||
return if (datetime.value == null || interval.value == null) { | ||
dateValue(null) | ||
} else { | ||
val datetimeValue = datetime.value!! | ||
val intervalValue = interval.long!! | ||
dateValue(datetimeValue.plusDays(intervalValue)) | ||
} |
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.
As discussed on tuesday, we should unbox and non-null assert for null calls as the engine checks the arguments before invoking the function.
val interval = args[0].check<Int32Value>() | |
val datetime = args[1].check<DateValue>() | |
return if (datetime.value == null || interval.value == null) { | |
dateValue(null) | |
} else { | |
val datetimeValue = datetime.value!! | |
val intervalValue = interval.long!! | |
dateValue(datetimeValue.plusDays(intervalValue)) | |
} | |
val interval = args[0].check<Int32Value>()!! | |
val datetime = args[1].check<DateValue>()!! | |
return dateValue(datetime.plusDays(interval)) |
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.
Can do that and all others in a follow up PR if ok with you.
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.
Good idea.
Relevant Issues
Description
Consider the function to be
date_diff(MINUTE, TIME '00:00:00', TIME WITH TIME ZONE '01:00:00+01:00')
and the session time zone is UTC. then the result should be0
.We need the session time zone to convert the first
Time
value toTime With Time Zone
value to do the comparison.Other Information
Updated Unreleased Section in CHANGELOG: [YES/NO]
Any backward-incompatible changes? [YES/NO]
Any new external dependencies? [YES/NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
Yes.
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.