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

Fix type cast to datetime #1328

Closed

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Feb 8, 2023

Description

TODO

Issues Resolved

#853

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: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen added the bug Something isn't working label Feb 8, 2023
@dai-chen dai-chen self-assigned this Feb 8, 2023
@dai-chen dai-chen linked an issue Feb 8, 2023 that may be closed by this pull request
@dai-chen dai-chen changed the title Fix cast to datetime Fix type cast to datetime Feb 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2023

Codecov Report

Merging #1328 (78a9930) into main (e990201) will not change coverage.
The diff coverage is n/a.

📣 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    #1328   +/-   ##
=========================================
  Coverage     98.36%   98.36%           
  Complexity     3636     3636           
=========================================
  Files           343      343           
  Lines          8990     8990           
  Branches        585      585           
=========================================
  Hits           8843     8843           
  Misses          142      142           
  Partials          5        5           
Flag Coverage Δ
sql-engine 98.36% <ø> (ø)

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.

@@ -314,6 +314,7 @@ public void castIntFieldToDoubleWithAliasJdbcFormatGroupByTest() {
rows("35.0"));
}

@Ignore("V2 engine doesn't support datetime with TZ")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add new tests instead of disabled. For example:

SELECT
  CAST(date0 AS date),
  CAST(time0 AS datetime),
  CAST(time1 AS time),  
  CAST(datetime0 AS timestamp),
FROM calcs;

Copy link
Collaborator

@MaxKsyunz MaxKsyunz left a comment

Choose a reason for hiding this comment

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

Oddly, an integration test failed built against java 11 but not 17.

2023-02-08T00:55:09.8325128Z org.opensearch.sql.ppl.PrometheusDataSourceCommandsIT > testSourceMetricCommandWithTimestamp FAILED
2023-02-08T00:55:09.8325926Z     org.opensearch.client.ResponseException: method [POST], host [http://127.0.0.1:44401], URI [/_plugins/_ppl], status line [HTTP/1.1 400 Bad Request]
2023-02-08T00:55:09.8326316Z     {
2023-02-08T00:55:09.8326507Z       "error": {
2023-02-08T00:55:09.8326729Z         "reason": "Invalid Query",
2023-02-08T00:55:09.8327490Z         "details": "timestamp:5-02-08 02:55:09 in unsupported format, please use yyyy-MM-dd HH:mm:ss[.SSSSSSSSS]",
2023-02-08T00:55:09.8327855Z         "type": "SemanticCheckException"
2023-02-08T00:55:09.8328094Z       },
2023-02-08T00:55:09.8328272Z       "status": 400
2023-02-08T00:55:09.8328470Z     }

@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented Feb 8, 2023

This test fails on some locales/timezones. You can track it in #1275.

@dai-chen
Copy link
Collaborator Author

dai-chen commented Feb 9, 2023

This test fails on some locales/timezones. You can track it in #1275.

Thanks for the info! Let me check and fix.

@dai-chen
Copy link
Collaborator Author

Closing due to #853 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Fix CAST ( ... AS DATETIME)
4 participants