-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support Alternate Datetime Formats #268
Support Alternate Datetime Formats #268
Conversation
…Search types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
… With Datetime Types Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit 2c16a554573015fcd752721353b2713858caad1a)
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
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.
We still need to get IT tests passed
opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java
Outdated
Show resolved
Hide resolved
...n/java/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilder.java
Outdated
Show resolved
Hide resolved
opensearch/src/test/java/org/opensearch/sql/opensearch/data/type/OpenSearchDataTypeTest.java
Show resolved
Hide resolved
opensearch/src/test/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateTypeTest.java
Outdated
Show resolved
Hide resolved
Do we need to update any doctest? |
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java
Outdated
Show resolved
Hide resolved
...n/java/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilder.java
Show resolved
Hide resolved
...n/java/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilder.java
Outdated
Show resolved
Hide resolved
...search/src/main/java/org/opensearch/sql/opensearch/storage/script/core/ExpressionScript.java
Outdated
Show resolved
Hide resolved
opensearch/src/test/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateTypeTest.java
Outdated
Show resolved
Hide resolved
…rage Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
integ-test/src/test/java/org/opensearch/sql/sql/DateTimeFunctionIT.java
Outdated
Show resolved
Hide resolved
...va/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilderTest.java
Outdated
Show resolved
Hide resolved
...va/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilderTest.java
Show resolved
Hide resolved
...est/java/org/opensearch/sql/opensearch/storage/script/filter/ExpressionFilterScriptTest.java
Show resolved
Hide resolved
...earch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
switch (mappingType) { | ||
public static OpenSearchDataType of(MappingType mappingType, Map<String, Object> innerMap) { | ||
OpenSearchDataType res = instances.getOrDefault(mappingType.toString(), | ||
new OpenSearchDataType(mappingType) |
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.
Why not null
here? I think instances
should contain all default instances since the very beginning.
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.
Changed in 58a8f19
|
||
private static final OpenSearchDateType instance = new OpenSearchDateType(); | ||
|
||
private static final String FORMAT_DELIMITER = "\\|\\|"; |
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.
Maybe
private static final String FORMAT_DELIMITER = "\\|\\|"; | |
private static final String FORMAT_DELIMITER_REGEX = "\\|\\|"; |
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.
UPD it is never used - remove?
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.
Done in 58a8f19
super(MappingType.Date); | ||
this.formatString = ""; | ||
this.exprCoreType = exprCoreType; |
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 can call one constructor from another one:
super(MappingType.Date); | |
this.formatString = ""; | |
this.exprCoreType = exprCoreType; | |
this(); | |
this.exprCoreType = exprCoreType; |
And the same below.
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.
Done in 58a8f19
opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java
Show resolved
Hide resolved
(c, dt) -> ExprBooleanValue.of(c.booleanValue())) | ||
//Handles the creation of DATE, TIME & DATETIME | ||
.put(OpenSearchDateType.of(TIME), | ||
(c, dt) -> createOpenSearchDateType(c, dt)) |
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.
nit
(c, dt) -> createOpenSearchDateType(c, dt)) | |
this::createOpenSearchDateType |
You can do the same with next 3 entries
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.
Done in 58a8f19
...earch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java
Show resolved
Hide resolved
...earch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java
Show resolved
Hide resolved
if (OpenSearchDateType.isDateTypeCompatible(group.type())) { | ||
builder.put(group.getNameOrAlias(), OpenSearchDateType.of(group.type())); |
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.
Move this logic into OpenSearchDataType.of
, so it will check compatibility and return the right object.
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.
Done in 58a8f19
if (OpenSearchDateType.isDateTypeCompatible(e.type())) { | ||
return OpenSearchDateType.of(e.type()); |
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.
The same - move compatibility check into of
method
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.
Done in 58a8f19
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
* Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Added IT Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Basic Implementation Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added A Comment Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Support For Default OpenSearch Formats Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Code Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Refactored 'parsetimestamp' Function Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Removed Unnecessary Try-Catch Block Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Unit Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed IT Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Text Type and Disabled JSON Format Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fix Mapping Type Reporting As Date Instead Of Timestamp In Schema Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Revert Breaking Test Changes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Returned ExprCoreTypes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed OpenSearch Type Names In Mapping Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed LegacyTypeName Function And Refactored Code To Fix Calculations With Datetime Types Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed Support For Passing Fields Into Text Type Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Some Changes And Commented Out A Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Commented Out A Breaking Change Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Minor Refactoring Changes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reworked parseTimestamp Function To Format Return Based On Enum Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Returned ExprValue Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Changes To Test Files Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Some Changes To Enum And Reworked Code Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Type Mapping To Allow Query To Be Parsed Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Some Unit Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed TypeActionMap To Still Support ExprCoreTypes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Wrapped Some Function Returns in ExprValueFactory Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Integration Test Bug Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit 2c16a554573015fcd752721353b2713858caad1a) * Slight Refactoring And Code Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit ebecec79c79d75e851a4a0914cf4abf5aa6d3efd) * Removed Unneeded Class Member Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit 14de39815ebeecd36c4155099d875a45a7e008f6) * Removed Unneccessary MappingType Parameters Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit e6a8bc3a6a3d7a11dacd03fc885871f3b055d2d2) * Refactored Code To Fix Integration Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit c91f48d9763499940ecf302212fcd592aecb6018) * Addressed JaCoCo Issues Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Checkstyle Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed gradle version and removed values iterator Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR Comments Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Update a test to match new indexResponse.aliases() type. Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> * Changed To Throw Exception When Encountering Parsing Failures Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Checkstyle Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Removed Unneeded Imports Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Re-enabled Some Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Addressed PR Comments Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed test data Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Pulled out support for user-defined datetime formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified IT test data Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Added IT tests Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed support for just time and just date formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed unsupported formats from IT Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed unit tests for date only or time only formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comments from previous PR Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comment regarding unnecessary OpenSearchDateType instance in OpenSearchDataType Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Updates to include build-in date and time formats for OpenSearchDateTypes Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Add tests and fix checkstyle Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Fixed bugs regarding custom formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Add unit test to cover custom formats Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed checkstyle errors Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified integration test Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed Date and time aggregation Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed failing integ tests Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified integ test based on date format changes Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Added default formatters for date and time. Added unit tests for coverage Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Some minor review comments Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed checktsyle and jacoco Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Changed link in rst file Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Changed link in rst file Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com>
* Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Added IT Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Basic Implementation Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added A Comment Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Support For Default OpenSearch Formats Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Code Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Refactored 'parsetimestamp' Function Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Removed Unnecessary Try-Catch Block Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Unit Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed IT Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Text Type and Disabled JSON Format Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fix Mapping Type Reporting As Date Instead Of Timestamp In Schema Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Revert Breaking Test Changes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Returned ExprCoreTypes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed OpenSearch Type Names In Mapping Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed LegacyTypeName Function And Refactored Code To Fix Calculations With Datetime Types Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed Support For Passing Fields Into Text Type Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Some Changes And Commented Out A Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Commented Out A Breaking Change Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Minor Refactoring Changes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reworked parseTimestamp Function To Format Return Based On Enum Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Returned ExprValue Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Changes To Test Files Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Reverted Some Changes To Enum And Reworked Code Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Added Type Mapping To Allow Query To Be Parsed Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Some Unit Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed TypeActionMap To Still Support ExprCoreTypes Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Wrapped Some Function Returns in ExprValueFactory Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Integration Test Bug Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit 2c16a554573015fcd752721353b2713858caad1a) * Slight Refactoring And Code Cleanup Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit ebecec79c79d75e851a4a0914cf4abf5aa6d3efd) * Removed Unneeded Class Member Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit 14de39815ebeecd36c4155099d875a45a7e008f6) * Removed Unneccessary MappingType Parameters Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit e6a8bc3a6a3d7a11dacd03fc885871f3b055d2d2) * Refactored Code To Fix Integration Test Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> (cherry picked from commit c91f48d9763499940ecf302212fcd592aecb6018) * Addressed JaCoCo Issues Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Checkstyle Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed gradle version and removed values iterator Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR Comments Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Update a test to match new indexResponse.aliases() type. Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> * Changed To Throw Exception When Encountering Parsing Failures Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Fixed Checkstyle Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Removed Unneeded Imports Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Re-enabled Some Tests Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Addressed PR Comments Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> * Changed test data Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Pulled out support for user-defined datetime formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified IT test data Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Added IT tests Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed support for just time and just date formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed unsupported formats from IT Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Removed unit tests for date only or time only formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comments from previous PR Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comment regarding unnecessary OpenSearchDateType instance in OpenSearchDataType Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Updates to include build-in date and time formats for OpenSearchDateTypes Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Add tests and fix checkstyle Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Fixed bugs regarding custom formats Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Add unit test to cover custom formats Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed checkstyle errors Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified integration test Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed Date and time aggregation Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed failing integ tests Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Modified integ test based on date format changes Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Added default formatters for date and time. Added unit tests for coverage Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Some minor review comments Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Fixed checktsyle and jacoco Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Changed link in rst file Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Changed link in rst file Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> * Addressed PR comments Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com>
* Support Alternate Datetime Formats (#268) * Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com>
* Support Alternate Datetime Formats (#268) * Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com>
* Support Alternate Datetime Formats (#268) * Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
…rch-project#1682) * Support Alternate Datetime Formats (#268) * Add OpenSearchDateType as a datatype for matching with Date/Time OpenSearch types Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> --------- Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com> Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Signed-off-by: Guian Gumpac <guian.gumpac@improving.com> Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com> Co-authored-by: GabeFernandez310 <Gabriel.Fernandez@improving.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> (cherry picked from commit 986db39) Co-authored-by: Guian Gumpac <guian.gumpac@improving.com>
Description
Supports using date/time/timestamp formats obtained from OpenSearch. Contains some changes from OpenSearchDataType rework (8b2f65d). Resolves some issues previously seen on the forum (please see Issues Resolved section below).
Formats that require only dates will return type of
date
. For example, the format "basic_date" will have typedate
in the result. Formats that require only times will return type oftime
. For example, the format "basic_time" will have typetime
in the result. Formats that can have eitherdate
ortime
will return type oftimestamp
. For example, the format "basic_date||basic_time" will have typetimestamp
in the result. This is also the case when using aggregation likeAVG
.Out of scope
Custom formats in the index mapping will be supported in a follow-up issue
TODO: Follow up with support for user-defined formats
Based on PoC (Here: https://github.com/Bit-Quill/opensearch-project-sql/pull/169/files).
Note: With these changes, issues may be introduced where data is read differently if a user's mapping defines a format. This is because the plugin previously used a hardcoded formatter to parse the data, while with these changes it will use the formatter defined in the mapping.
Supported formats include named formats listed in: opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java or https://opensearch.org/docs/latest/field-types/supported-field-types/date/
Issues Resolved
opensearch-project#794
https://forum.opensearch.org/t/sql-select-fails-on-date-fields-format-epoch-second/11521
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.