-
Notifications
You must be signed in to change notification settings - Fork 179
Add TIMEDIFF and DATEDIFF functions. (#131)
#1195
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
Add TIMEDIFF and DATEDIFF functions. (#131)
#1195
Conversation
* Add `TIMEDIFF` and `DATEDIFF` functions. Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Max Ksyunz <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (62.76%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## main #1195 +/- ##
=============================================
- Coverage 98.32% 62.76% -35.56%
=============================================
Files 344 10 -334
Lines 8762 658 -8104
Branches 554 119 -435
=============================================
- Hits 8615 413 -8202
- Misses 142 192 +50
- Partials 5 53 +48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* Add `TIMEDIFF` and `DATEDIFF` functions. Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Max Ksyunz <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Max Ksyunz <[email protected]> (cherry picked from commit 438c44d)
* Add `TIMEDIFF` and `DATEDIFF` functions. Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Max Ksyunz <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Max Ksyunz <[email protected]> (cherry picked from commit 438c44d) Co-authored-by: Yury-Fridlyand <[email protected]>
|
Hi I don't see these functions available in latest version https://opensearch.org/docs/latest/search-plugins/sql/functions/#date-and-time. Can you please confirm if these are available? If not, by when these will be made available? |
|
@VenkatManuru, |
Signed-off-by: Yury-Fridlyand [email protected]
Description
I referred to MySQL docs and tried to reproduce MySQL v.8.0.30 behavior as a reference.
See team review and discussion on Bit-Quill#131
New function:
TIMEDIFF.Changes
Signature
Future changes (TODOs):
TIME? #852Test queries:
New function:
DATEDIFF.Changes
Fully compliant with MySQL.
Signature
Future changes (TODOs):
Accept strings if it gives performance gain
Test queries:
Test data
I found that first 6 rows from
date0,time0,time1,datetime0are good for testing - these columns have different data types in MySQL. In OpenSearch SQL all[date][time]columns havetimestamptype, so I useCASTfor clear testing.data
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.