Skip to content

Conversation

@Yury-Fridlyand
Copy link

@Yury-Fridlyand Yury-Fridlyand commented Oct 20, 2022

Description

Depends on #132/opensearch-project#1194

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

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.

@codecov

This comment was marked as spam.

@acarbonetto acarbonetto changed the title Update TIMESTAMP function [BLOCKED] Update TIMESTAMP function Oct 25, 2022
Signed-off-by: Yury-Fridlyand <[email protected]>
@Yury-Fridlyand Yury-Fridlyand changed the title [BLOCKED] Update TIMESTAMP function Update TIMESTAMP function Dec 13, 2022
@acarbonetto
Copy link

acarbonetto commented Dec 15, 2022

  1. Please add the description from your reference of what one vs two arguments is intended to do:
With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments
  1. For section Test queries: please include the results

@acarbonetto
Copy link

You can also reference opensearch-project#722 as part of this PR in that this PR does partially fix opensearch-project#722

Copy link

@acarbonetto acarbonetto left a comment

Choose a reason for hiding this comment

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

Quick question about getting timestampValue

FunctionProperties functionProperties) {
return value instanceof ExprTimeValue
? ((ExprTimeValue) value).timestampValue(functionProperties)
: value.timestampValue();

Choose a reason for hiding this comment

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

Oooh. I do not like this logic is required here.
It would be better if the logic was in Expr*Value classes.

Copy link
Author

Choose a reason for hiding this comment

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

Can you give an example, please?

Signed-off-by: Yury-Fridlyand <[email protected]>

Co-authored-by: Andrew Carbonetto <[email protected]>
@Yury-Fridlyand Yury-Fridlyand merged commit 3fcb2b3 into integ-update-timestamp Dec 20, 2022
@Yury-Fridlyand Yury-Fridlyand deleted the dev-update-timestamp branch December 20, 2022 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants