forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of timestamp/date/time using curly brackets (opensearch…
…-project#1894) * Added support of timestamp/date/time using curly brackets (#297) * added bracketed time/date/timestamp input, tests, and documentation Signed-off-by: Matthew Wells <[email protected]> * improved failing tests Signed-off-by: Matthew Wells <[email protected]> * simplified tests for checking for failure Signed-off-by: Matthew Wells <[email protected]> * fixed redundant tests and improved tests that should fail Signed-off-by: Matthew Wells <[email protected]> --------- Signed-off-by: Matthew Wells <[email protected]> (cherry picked from commit 1a7134b)
- Loading branch information
1 parent
1d9583a
commit d0d9daf
Showing
6 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
2 changes: 0 additions & 2 deletions
2
sql/src/test/java/org/opensearch/sql/common/antlr/SyntaxParserTestBase.java
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
41 changes: 41 additions & 0 deletions
41
sql/src/test/java/org/opensearch/sql/sql/antlr/BracketedTimestampTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
package org.opensearch.sql.sql.antlr; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class BracketedTimestampTest extends SQLParserTest { | ||
@Test | ||
void date_shortened_test() { | ||
acceptQuery("SELECT {d '2001-05-07'}"); | ||
} | ||
|
||
@Test | ||
void date_test() { | ||
acceptQuery("SELECT {date '2001-05-07'}"); | ||
} | ||
|
||
@Test | ||
void time_shortened_test() { | ||
acceptQuery("SELECT {t '10:11:12'}"); | ||
} | ||
|
||
@Test | ||
void time_test() { | ||
acceptQuery("SELECT {time '10:11:12'}"); | ||
} | ||
|
||
@Test | ||
void timestamp_shortened_test() { | ||
acceptQuery("SELECT {ts '2001-05-07 10:11:12'}"); | ||
} | ||
|
||
@Test | ||
void timestamp_test() { | ||
acceptQuery("SELECT {timestamp '2001-05-07 10:11:12'}"); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
sql/src/test/java/org/opensearch/sql/sql/antlr/SQLParserTest.java
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