This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 186
Support DateTime Casting in CAST() function #271
Closed
davidcui1225
wants to merge
13
commits into
opendistro-for-elasticsearch:master
from
davidcui1225:issue-268
Closed
Support DateTime Casting in CAST() function #271
davidcui1225
wants to merge
13
commits into
opendistro-for-elasticsearch:master
from
davidcui1225:issue-268
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidcui1225
requested review from
galkk,
penghuo,
chloe-zh,
dai-chen and
abbashus
November 5, 2019 19:30
dai-chen
reviewed
Nov 5, 2019
@@ -312,6 +317,86 @@ public void castIntFieldToDoubleWithAliasJdbcFormatGroupByTest() { | |||
} | |||
} | |||
|
|||
@Test | |||
public void castFieldToDatetimeWithoutAliasTest() throws IOException { | |||
String query = "SELECT CAST(insert_time AS DATETIME) FROM " + TestsConstants.TEST_INDEX_ONLINE + |
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.
I see that index online doesn't have predefined mapping. Could you check if field insert_time
is already a date in ES? If so, I think we need to test against fields of different type, ex. keyword. I assume that's the point of CAST
statement.
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.
You're right- will find other fields to test the Datetime cast
src/main/java/com/amazon/opendistroforelasticsearch/sql/parser/CastParser.java
Show resolved
Hide resolved
Closing this pull request for #310 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
#268
Description of changes:
Add support to cast to DateTime in CAST() in
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
format.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.