-
Notifications
You must be signed in to change notification settings - Fork 35
Duration uncertainty #340
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
Duration uncertainty #340
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #340 +/- ##
==========================================
+ Coverage 87.43% 87.46% +0.02%
==========================================
Files 52 52
Lines 4536 4546 +10
Branches 1280 1284 +4
==========================================
+ Hits 3966 3976 +10
Misses 361 361
Partials 209 209 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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, @elsaperelli. I think the approach is right on, but I'm made a small suggestion for your consideration and I think I also discovered a tiny mistake in the tests.
1f41ad6
to
1693a26
Compare
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.
Forgive me for not thinking of this before, but... I think that the approach only holds true for durations when the precision is seconds and above.
In the Date, DateTime, and Time section of the Author's guide, it says (emphasis mine):
In other words, when performing comparisons or calculations for precisions of seconds and above, if milliseconds are not specified, the calculation should be performed as though milliseconds had been specified as 0.
And in the DateTime and Time sections of the reference it says something similar (again, emphasis mine):
In other words, if milliseconds are not specified, calculations for precisions above milliseconds should be performed as though milliseconds had been specified as 0.
So if the expression is milliseconds between A and B
then we should not convert null milliseconds to 0. I think this means that in the duration code, we additionally need to check the unitField
argument of durationBetween
to make sure it's not milliseconds. Do you agree with that interpretation of the spec?
… seconds is not null
94a2365
to
50e3ac1
Compare
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, Elsa! This seems to do the trick!
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!
Summary
This PR updates the functionality of
durationBetween
calculations in order to match the latest descriptions in the CQL Logical Specification described here. This PR also fixes #325.According to the CQL Logical Specification, "Note that uncertainty calculations, just like date and time comparison calculations, consider seconds and milliseconds as a single combined precision with decimal semantics". This means that the duration between calculation should NOT produce an Uncertainty in both cases: when ms are defined and when ms are not defined.
Pull requests into cql-execution require the following.
Submitter and reviewer should ✔ when done.
For items that are not-applicable, mark "N/A" and ✔.
Submitter:
npm run test:plus
to run tests, lint, and prettier)cql4browsers.js
built withnpm run build:browserify
if source changed.Reviewer:
Name:
Additional Testing Guidance