Skip to content
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

Update TIMESTAMP function implementation and signatures. #1254

Merged
merged 6 commits into from
Feb 15, 2023

Conversation

Yury-Fridlyand
Copy link
Collaborator

Signed-off-by: Yury-Fridlyand yury.fridlyand@improving.com

Description

I referred to MySQL docs and tried to reproduce MySQL v.8.0.30 behavior as a reference.

See team review and discussion in Bit-Quill#139

Updated function: TIMESTAMP

Signatures

(STRING/DATE/TIME/DATETIME/TIMESTAMP) -> TIMESTAMP
(STRING/DATE/TIME/DATETIME/TIMESTAMP, STRING/DATE/TIME/DATETIME/TIMESTAMP) -> TIMESTAMP

Notes:

Unlike MySQL, TIMESTAMP function returns a TIMESTAMP object (Instant), not a DATETIME.

Test queries:

SELECT TIMESTAMP('2020-08-26 13:49:00'), TIMESTAMP('2020-08-26 13:49:00', TIME('12:15:42'));

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2023

Codecov Report

Merging #1254 (f4326d3) into main (a4f8066) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main    #1254      +/-   ##
============================================
- Coverage     98.35%   98.35%   -0.01%     
- Complexity     3617     3618       +1     
============================================
  Files           343      343              
  Lines          8927     8923       -4     
  Branches        569      569              
============================================
- Hits           8780     8776       -4     
  Misses          142      142              
  Partials          5        5              
Flag Coverage Δ
sql-engine 98.35% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/main/java/org/opensearch/sql/expression/DSL.java 100.00% <100.00%> (ø)
...arch/sql/expression/datetime/DateTimeFunction.java 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Yury-Fridlyand Yury-Fridlyand marked this pull request as draft January 9, 2023 21:34
@Yury-Fridlyand Yury-Fridlyand marked this pull request as ready for review January 9, 2023 22:32
YANG-DB
YANG-DB previously approved these changes Jan 9, 2023
@dai-chen dai-chen added the enhancement New feature or request label Jan 17, 2023
@Yury-Fridlyand Yury-Fridlyand marked this pull request as draft January 24, 2023 03:50
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
…ime types cast (PR opensearch-project#1196).

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand marked this pull request as ready for review January 26, 2023 04:01
dai-chen
dai-chen previously approved these changes Jan 26, 2023
Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

acarbonetto
acarbonetto previously approved these changes Jan 27, 2023
@@ -419,7 +419,12 @@ public static FunctionExpression time_to_sec(Expression... expressions) {
}

public static FunctionExpression timestamp(Expression... expressions) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why leave this function signature? There are only about 10 tests to update to remove this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All functions from this file are used in tests only.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand dismissed stale reviews from acarbonetto and dai-chen via 2e04408 February 7, 2023 21:12
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@dai-chen dai-chen merged commit ecb9dec into opensearch-project:main Feb 15, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 15, 2023
* Update `TIMESTAMP` function implementation and signatures.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Simplify `TIMESTAMP` function implementation by using automatic datetime types cast (PR #1196).

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Checkstyle fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

---------

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
(cherry picked from commit ecb9dec)
dai-chen pushed a commit that referenced this pull request Feb 15, 2023
…1340)

* Update `TIMESTAMP` function implementation and signatures.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Simplify `TIMESTAMP` function implementation by using automatic datetime types cast (PR #1196).

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Checkstyle fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

---------

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
(cherry picked from commit ecb9dec)

Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand deleted the dev-update-timestamp branch February 15, 2023 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants