-
Notifications
You must be signed in to change notification settings - Fork 141
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 datetime functions FROM_UNIXTIME
and UNIX_TIMESTAMP
#835
Add datetime functions FROM_UNIXTIME
and UNIX_TIMESTAMP
#835
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #835 +/- ##
=============================================
+ Coverage 62.76% 94.93% +32.16%
- Complexity 0 2973 +2973
=============================================
Files 10 291 +281
Lines 658 7949 +7291
Branches 118 578 +460
=============================================
+ Hits 413 7546 +7133
- Misses 192 349 +157
- Partials 53 54 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
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.
LGTM. Thanks for the changes!
Maybe I need to rename |
Sure, we can do it now or later. Thanks! |
* Add implementation for `FROM_UNIXTIME` and `UNIX_TIMESTAMP` functions, UT and IT. Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
a96cce3
to
181b263
Compare
Please, |
…ch-project#835) * Add datetime functions `FROM_UNIXTIME` and `UNIX_TIMESTAMP` (#114) * Add implementation for `FROM_UNIXTIME` and `UNIX_TIMESTAMP` functions, UT and IT. Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com> * Collent all DateTime formatters into one place. Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com> * Rename `DateFormatters` -> `DateTimeFormatters`. Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
FROM_UNIXTIME
(DOUBLE) -> DATETIME
(DOUBLE, STRING) -> STRING
Implementation details
DATE_FORMAT
function is used1970-01-01 00:00:00
-3001-01-18 23:59:59.999999
NOTES
DOUBLE
affected by Floating Point ImprecisionExample
Test samples
SQL
PPL
UNIX_TIMESTAMP
() -> LONG
DATE -> DOUBLE
DATETIME -> DOUBLE
TIMESTAMP -> DOUBLE
DOUBLE -> DOUBLE
Implementation details
LocalDateTime.now()
without caching the value. Sequential calls in one query might return different values.1970-01-01 00:00:00
-3001-01-18 23:59:59.999999
.NOTES
DOUBLE
affected by Floating Point ImprecisionExample
Test samples
SQL
PPL
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.