From 611aa7e7a04dee84644f5131fd92821044dd1b2c Mon Sep 17 00:00:00 2001 From: YANGDB Date: Wed, 11 Oct 2023 17:51:05 -0700 Subject: [PATCH 1/7] add 2.11 release notes Signed-off-by: YANGDB --- .../opensearch-sql.release-notes-2.11.0.0.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 release-notes/opensearch-sql.release-notes-2.11.0.0.md diff --git a/release-notes/opensearch-sql.release-notes-2.11.0.0.md b/release-notes/opensearch-sql.release-notes-2.11.0.0.md new file mode 100644 index 0000000000..f99a309297 --- /dev/null +++ b/release-notes/opensearch-sql.release-notes-2.11.0.0.md @@ -0,0 +1,55 @@ +Compatible with OpenSearch and OpenSearch Dashboards Version 2.10.0 + +### Features + +### Enhancements +* [Backport 2.x] Enable PPL lang and add datasource to async query API in https://github.com/opensearch-project/sql/pull/2195 +* [Backport 2.x] Refactor Flint Auth in https://github.com/opensearch-project/sql/pull/2201 +* [Backport 2.x] Add conf for spark structured streaming job in https://github.com/opensearch-project/sql/pull/2203 +* [Backport 2.x] Submit long running job only when auto_refresh = false in https://github.com/opensearch-project/sql/pull/2209 +* [Backport 2.x] Bug Fix, handle DESC TABLE response in https://github.com/opensearch-project/sql/pull/2213 +* [Backport 2.x] Drop Index Implementation in https://github.com/opensearch-project/sql/pull/2217 +* [Backport 2.x] Enable PPL Queries in https://github.com/opensearch-project/sql/pull/2223 +* [Backport 2.11] Read extra Spark submit parameters from cluster settings in https://github.com/opensearch-project/sql/pull/2236 +* [Backport 2.11] Spark Execution Engine Config Refactor in https://github.com/opensearch-project/sql/pull/2266 +* [Backport 2.11] Provide auth.type and auth.role_arn paramters in GET Datasource API response. in https://github.com/opensearch-project/sql/pull/2283 +* [Backport 2.x] Add support for `date_nanos` and tests. (#337) in https://github.com/opensearch-project/sql/pull/2020 +* [Backport 2.x] Applied formatting improvements to Antlr files based on spotless changes (#2017) by @MitchellGale in https://github.com/opensearch-project/sql/pull/2023 +* [Backport 2.x] Revert "Guarantee datasource read api is strong consistent read (#1815)" in https://github.com/opensearch-project/sql/pull/2031 +* [Backport 2.x] Add _primary preference only for segment replication enabled indices in https://github.com/opensearch-project/sql/pull/2045 +* [Backport 2.x] Changed allowlist config to denylist ip config for datasource uri hosts in https://github.com/opensearch-project/sql/pull/2058 + +### Bug Fixes +* [Backport 2.x] fix broken link for connectors doc in https://github.com/opensearch-project/sql/pull/2199 +* [Backport 2.x] Fix response codes returned by JSON formatting them in https://github.com/opensearch-project/sql/pull/2200 +* [Backport 2.x] Bug fix, datasource API should be case sensitive in https://github.com/opensearch-project/sql/pull/2202 +* [Backport 2.11] Minor fix in dropping covering index in https://github.com/opensearch-project/sql/pull/2240 +* [Backport 2.11] Fix Unit tests for FlintIndexReader in https://github.com/opensearch-project/sql/pull/2242 +* [Backport 2.11] Bug Fix , delete OpenSearch index when DROP INDEX in https://github.com/opensearch-project/sql/pull/2252 +* [Backport 2.11] Correctly Set query status in https://github.com/opensearch-project/sql/pull/2232 +* [Backport 2.x] Exclude generated files from spotless in https://github.com/opensearch-project/sql/pull/2024 +* [Backport 2.x] Fix mockito core conflict. in https://github.com/opensearch-project/sql/pull/2131 +* [Backport 2.x] Fix `ASCII` function and groom UT for text functions. (#301) in https://github.com/opensearch-project/sql/pull/2029 +* [Backport 2.x] Fixed response codes For Requests With security exception. in https://github.com/opensearch-project/sql/pull/2036 + +### Documentation +* [Backport 2.x] Datasource description in https://github.com/opensearch-project/sql/pull/2138 +* [Backport 2.11] Add documentation for S3GlueConnector. in https://github.com/opensearch-project/sql/pull/2234 + +### Infrastructure +* [Backport 2.x] bump aws-encryption-sdk-java to 1.71 in https://github.com/opensearch-project/sql/pull/2057 +* [Backport 2.x] Run IT tests with security plugin (#335) #1986 by @MitchellGale in https://github.com/opensearch-project/sql/pull/2022 + +### Refactoring +* [Backport 2.x] Merging Async Query APIs feature branch into main. in https://github.com/opensearch-project/sql/pull/2163 +* [Backport 2.x] Removed Domain Validation in https://github.com/opensearch-project/sql/pull/2136 +* [Backport 2.x] Check for existence of security plugin in https://github.com/opensearch-project/sql/pull/2069 +* [Backport 2.x] Always use snapshot version for security plugin download in https://github.com/opensearch-project/sql/pull/2061 +* [Backport 2.x] Add customized result index in data source etc in https://github.com/opensearch-project/sql/pull/2220 + +### Security +* [2.x] bump okhttp to 4.10.0 (#2043) by @joshuali925 in https://github.com/opensearch-project/sql/pull/2044 +* [2.x] bump okio to 3.4.0 by @joshuali925 in https://github.com/opensearch-project/sql/pull/2047 + +--- +**Full Changelog**: https://github.com/opensearch-project/sql/compare/2.3.0.0...v.2.11.0.0 \ No newline at end of file From 2b4ab28399572c7cedb088b6f4be4f6180294081 Mon Sep 17 00:00:00 2001 From: YANGDB Date: Wed, 11 Oct 2023 17:51:20 -0700 Subject: [PATCH 2/7] add 2.11 release notes Signed-off-by: YANGDB --- release-notes/opensearch-sql.release-notes-2.11.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/opensearch-sql.release-notes-2.11.0.0.md b/release-notes/opensearch-sql.release-notes-2.11.0.0.md index f99a309297..7434f4e95a 100644 --- a/release-notes/opensearch-sql.release-notes-2.11.0.0.md +++ b/release-notes/opensearch-sql.release-notes-2.11.0.0.md @@ -1,4 +1,4 @@ -Compatible with OpenSearch and OpenSearch Dashboards Version 2.10.0 +Compatible with OpenSearch and OpenSearch Dashboards Version 2.11.0 ### Features From 61f96c8e60f5a7c299b04ccdc052954482d6cdcf Mon Sep 17 00:00:00 2001 From: YANGDB Date: Thu, 12 Oct 2023 09:02:50 -0700 Subject: [PATCH 3/7] update notes Signed-off-by: YANGDB --- .../opensearch-sql.release-notes-2.11.0.0.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/release-notes/opensearch-sql.release-notes-2.11.0.0.md b/release-notes/opensearch-sql.release-notes-2.11.0.0.md index 7434f4e95a..a560d5c8dd 100644 --- a/release-notes/opensearch-sql.release-notes-2.11.0.0.md +++ b/release-notes/opensearch-sql.release-notes-2.11.0.0.md @@ -3,53 +3,53 @@ Compatible with OpenSearch and OpenSearch Dashboards Version 2.11.0 ### Features ### Enhancements -* [Backport 2.x] Enable PPL lang and add datasource to async query API in https://github.com/opensearch-project/sql/pull/2195 -* [Backport 2.x] Refactor Flint Auth in https://github.com/opensearch-project/sql/pull/2201 -* [Backport 2.x] Add conf for spark structured streaming job in https://github.com/opensearch-project/sql/pull/2203 -* [Backport 2.x] Submit long running job only when auto_refresh = false in https://github.com/opensearch-project/sql/pull/2209 -* [Backport 2.x] Bug Fix, handle DESC TABLE response in https://github.com/opensearch-project/sql/pull/2213 -* [Backport 2.x] Drop Index Implementation in https://github.com/opensearch-project/sql/pull/2217 -* [Backport 2.x] Enable PPL Queries in https://github.com/opensearch-project/sql/pull/2223 -* [Backport 2.11] Read extra Spark submit parameters from cluster settings in https://github.com/opensearch-project/sql/pull/2236 -* [Backport 2.11] Spark Execution Engine Config Refactor in https://github.com/opensearch-project/sql/pull/2266 -* [Backport 2.11] Provide auth.type and auth.role_arn paramters in GET Datasource API response. in https://github.com/opensearch-project/sql/pull/2283 -* [Backport 2.x] Add support for `date_nanos` and tests. (#337) in https://github.com/opensearch-project/sql/pull/2020 -* [Backport 2.x] Applied formatting improvements to Antlr files based on spotless changes (#2017) by @MitchellGale in https://github.com/opensearch-project/sql/pull/2023 -* [Backport 2.x] Revert "Guarantee datasource read api is strong consistent read (#1815)" in https://github.com/opensearch-project/sql/pull/2031 -* [Backport 2.x] Add _primary preference only for segment replication enabled indices in https://github.com/opensearch-project/sql/pull/2045 -* [Backport 2.x] Changed allowlist config to denylist ip config for datasource uri hosts in https://github.com/opensearch-project/sql/pull/2058 +* Enable PPL lang and add datasource to async query API in https://github.com/opensearch-project/sql/pull/2195 +* Refactor Flint Auth in https://github.com/opensearch-project/sql/pull/2201 +* Add conf for spark structured streaming job in https://github.com/opensearch-project/sql/pull/2203 +* Submit long running job only when auto_refresh = false in https://github.com/opensearch-project/sql/pull/2209 +* Bug Fix, handle DESC TABLE response in https://github.com/opensearch-project/sql/pull/2213 +* Drop Index Implementation in https://github.com/opensearch-project/sql/pull/2217 +* Enable PPL Queries in https://github.com/opensearch-project/sql/pull/2223 +* Read extra Spark submit parameters from cluster settings in https://github.com/opensearch-project/sql/pull/2236 +* Spark Execution Engine Config Refactor in https://github.com/opensearch-project/sql/pull/2266 +* Provide auth.type and auth.role_arn paramters in GET Datasource API response. in https://github.com/opensearch-project/sql/pull/2283 +* Add support for `date_nanos` and tests. (#337) in https://github.com/opensearch-project/sql/pull/2020 +* Applied formatting improvements to Antlr files based on spotless changes (#2017) by @MitchellGale in https://github.com/opensearch-project/sql/pull/2023 +* Revert "Guarantee datasource read api is strong consistent read (#1815)" in https://github.com/opensearch-project/sql/pull/2031 +* Add _primary preference only for segment replication enabled indices in https://github.com/opensearch-project/sql/pull/2045 +* Changed allowlist config to denylist ip config for datasource uri hosts in https://github.com/opensearch-project/sql/pull/2058 ### Bug Fixes -* [Backport 2.x] fix broken link for connectors doc in https://github.com/opensearch-project/sql/pull/2199 -* [Backport 2.x] Fix response codes returned by JSON formatting them in https://github.com/opensearch-project/sql/pull/2200 -* [Backport 2.x] Bug fix, datasource API should be case sensitive in https://github.com/opensearch-project/sql/pull/2202 -* [Backport 2.11] Minor fix in dropping covering index in https://github.com/opensearch-project/sql/pull/2240 -* [Backport 2.11] Fix Unit tests for FlintIndexReader in https://github.com/opensearch-project/sql/pull/2242 -* [Backport 2.11] Bug Fix , delete OpenSearch index when DROP INDEX in https://github.com/opensearch-project/sql/pull/2252 -* [Backport 2.11] Correctly Set query status in https://github.com/opensearch-project/sql/pull/2232 -* [Backport 2.x] Exclude generated files from spotless in https://github.com/opensearch-project/sql/pull/2024 -* [Backport 2.x] Fix mockito core conflict. in https://github.com/opensearch-project/sql/pull/2131 -* [Backport 2.x] Fix `ASCII` function and groom UT for text functions. (#301) in https://github.com/opensearch-project/sql/pull/2029 -* [Backport 2.x] Fixed response codes For Requests With security exception. in https://github.com/opensearch-project/sql/pull/2036 +* fix broken link for connectors doc in https://github.com/opensearch-project/sql/pull/2199 +* Fix response codes returned by JSON formatting them in https://github.com/opensearch-project/sql/pull/2200 +* Bug fix, datasource API should be case sensitive in https://github.com/opensearch-project/sql/pull/2202 +* Minor fix in dropping covering index in https://github.com/opensearch-project/sql/pull/2240 +* Fix Unit tests for FlintIndexReader in https://github.com/opensearch-project/sql/pull/2242 +* Bug Fix , delete OpenSearch index when DROP INDEX in https://github.com/opensearch-project/sql/pull/2252 +* Correctly Set query status in https://github.com/opensearch-project/sql/pull/2232 +* Exclude generated files from spotless in https://github.com/opensearch-project/sql/pull/2024 +* Fix mockito core conflict. in https://github.com/opensearch-project/sql/pull/2131 +* Fix `ASCII` function and groom UT for text functions. (#301) in https://github.com/opensearch-project/sql/pull/2029 +* Fixed response codes For Requests With security exception. in https://github.com/opensearch-project/sql/pull/2036 ### Documentation -* [Backport 2.x] Datasource description in https://github.com/opensearch-project/sql/pull/2138 -* [Backport 2.11] Add documentation for S3GlueConnector. in https://github.com/opensearch-project/sql/pull/2234 +* Datasource description in https://github.com/opensearch-project/sql/pull/2138 +* Add documentation for S3GlueConnector. in https://github.com/opensearch-project/sql/pull/2234 ### Infrastructure -* [Backport 2.x] bump aws-encryption-sdk-java to 1.71 in https://github.com/opensearch-project/sql/pull/2057 -* [Backport 2.x] Run IT tests with security plugin (#335) #1986 by @MitchellGale in https://github.com/opensearch-project/sql/pull/2022 +* bump aws-encryption-sdk-java to 1.71 in https://github.com/opensearch-project/sql/pull/2057 +* Run IT tests with security plugin (#335) #1986 by @MitchellGale in https://github.com/opensearch-project/sql/pull/2022 ### Refactoring -* [Backport 2.x] Merging Async Query APIs feature branch into main. in https://github.com/opensearch-project/sql/pull/2163 -* [Backport 2.x] Removed Domain Validation in https://github.com/opensearch-project/sql/pull/2136 -* [Backport 2.x] Check for existence of security plugin in https://github.com/opensearch-project/sql/pull/2069 -* [Backport 2.x] Always use snapshot version for security plugin download in https://github.com/opensearch-project/sql/pull/2061 -* [Backport 2.x] Add customized result index in data source etc in https://github.com/opensearch-project/sql/pull/2220 +* Merging Async Query APIs feature branch into main. in https://github.com/opensearch-project/sql/pull/2163 +* Removed Domain Validation in https://github.com/opensearch-project/sql/pull/2136 +* Check for existence of security plugin in https://github.com/opensearch-project/sql/pull/2069 +* Always use snapshot version for security plugin download in https://github.com/opensearch-project/sql/pull/2061 +* Add customized result index in data source etc in https://github.com/opensearch-project/sql/pull/2220 ### Security -* [2.x] bump okhttp to 4.10.0 (#2043) by @joshuali925 in https://github.com/opensearch-project/sql/pull/2044 -* [2.x] bump okio to 3.4.0 by @joshuali925 in https://github.com/opensearch-project/sql/pull/2047 +* bump okhttp to 4.10.0 (#2043) by @joshuali925 in https://github.com/opensearch-project/sql/pull/2044 +* bump okio to 3.4.0 by @joshuali925 in https://github.com/opensearch-project/sql/pull/2047 --- **Full Changelog**: https://github.com/opensearch-project/sql/compare/2.3.0.0...v.2.11.0.0 \ No newline at end of file From 7b2fa89d14a5b9ae4226d1bd589558d9da14e409 Mon Sep 17 00:00:00 2001 From: YANGDB Date: Mon, 1 Jan 2024 21:21:41 -0800 Subject: [PATCH 4/7] fix spotlessApply issues Signed-off-by: YANGDB --- .../sql/ppl/ConvertTZFunctionWithGetIT.java | 19 +++++++++++ .../opensearch/sql/ppl/DataTypeWithGetIT.java | 18 +++++++++++ .../sql/ppl/DateTimeComparisonWithGetIT.java | 22 +++++++++++++ .../sql/ppl/DateTimeFunctionWithGetIT.java | 18 +++++++++++ .../ppl/DateTimeImplementationWithGetIT.java | 18 +++++++++++ .../sql/ppl/DedupCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/DescribeCommandWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/ExplainWithGetIT.java | 18 +++++++++++ .../sql/ppl/FieldsCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/HeadCommandWithGetIT.java | 18 +++++++++++ .../InformationSchemaCommandWithGetIT.java | 18 +++++++++++ .../ppl/LegacyAPICompatibilityWithGetIT.java | 18 +++++++++++ .../sql/ppl/LikeQueryWithGetIT.java | 18 +++++++++++ .../sql/ppl/MatchBoolPrefixWithGetIT.java | 18 +++++++++++ .../sql/ppl/MatchPhrasePrefixWithGetIT.java | 18 +++++++++++ .../sql/ppl/MatchPhraseWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/MatchWithGetIT.java | 18 +++++++++++ .../ppl/MathematicalFunctionWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/MetricsWithGetIT.java | 17 ++++++++++ .../sql/ppl/MultiMatchWithGetIT.java | 31 ++++++++++++++++++ .../sql/ppl/NowLikeFunctionWithGetIT.java | 32 +++++++++++++++++++ .../sql/ppl/ObjectFieldOperateWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/OperatorWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/PPLIntegTestCase.java | 23 +++++++++++++ .../sql/ppl/ParseCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/PositionFunctionWithGetIT.java | 18 +++++++++++ ...PrometheusDataSourceCommandsWithGetIT.java | 18 +++++++++++ .../sql/ppl/QueryAnalysisWithGetIT.java | 18 +++++++++++ .../sql/ppl/QueryStringWithGetIT.java | 18 +++++++++++ .../sql/ppl/RareCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/RelevanceFunctionWithGetIT.java | 18 +++++++++++ .../sql/ppl/RenameCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/ResourceMonitorWithGetIT.java | 18 +++++++++++ .../sql/ppl/SearchCommandWithGetIT.java | 18 +++++++++++ .../opensearch/sql/ppl/SettingsWithGetIT.java | 18 +++++++++++ .../ppl/ShowDataSourcesCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/SimpleQueryStringWithGetIT.java | 18 +++++++++++ .../sql/ppl/SortCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/StatsCommandWithGetIT.java | 18 +++++++++++ .../sql/ppl/SystemFunctionWithGetIT.java | 18 +++++++++++ .../sql/ppl/TextFunctionWithGetIT.java | 19 +++++++++++ .../sql/ppl/TopCommandWithGetIT.java | 20 ++++++++++++ .../sql/ppl/WhereCommandWithGetIT.java | 20 ++++++++++++ .../request/PPLQueryRequestFactory.java | 3 +- .../sql/plugin/rest/RestPPLQueryAction.java | 8 ++++- spark/src/main/antlr/SqlBaseLexer.g4 | 2 ++ spark/src/main/antlr/SqlBaseParser.g4 | 30 +++++++++++++++-- 47 files changed, 852 insertions(+), 6 deletions(-) create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ConvertTZFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DataTypeWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeComparisonWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeImplementationWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DedupCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/DescribeCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ExplainWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/FieldsCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/HeadCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/LegacyAPICompatibilityWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/LikeQueryWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MatchBoolPrefixWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhrasePrefixWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhraseWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MatchWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MathematicalFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MetricsWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/MultiMatchWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/NowLikeFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ObjectFieldOperateWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/OperatorWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ParseCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/PositionFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/QueryAnalysisWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/RareCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/RelevanceFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/RenameCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ResourceMonitorWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/SearchCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/SettingsWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/ShowDataSourcesCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/SortCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/StatsCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/SystemFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/TextFunctionWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/TopCommandWithGetIT.java create mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/WhereCommandWithGetIT.java diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ConvertTZFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ConvertTZFunctionWithGetIT.java new file mode 100644 index 0000000000..9ebda09294 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ConvertTZFunctionWithGetIT.java @@ -0,0 +1,19 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import static org.opensearch.rest.RestRequest.Method.GET; + +import java.io.IOException; + +/** Run ConvertTZFunctionIT tests using http GET request */ +public class ConvertTZFunctionWithGetIT extends ConvertTZFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DataTypeWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DataTypeWithGetIT.java new file mode 100644 index 0000000000..3cdfe5f869 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DataTypeWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DataTypeIT tests using http GET request */ +public class DataTypeWithGetIT extends DataTypeIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeComparisonWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeComparisonWithGetIT.java new file mode 100644 index 0000000000..e027dccf2b --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeComparisonWithGetIT.java @@ -0,0 +1,22 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DateTimeComparisonIT tests using http GET request */ +public class DateTimeComparisonWithGetIT extends DateTimeComparisonIT { + public DateTimeComparisonWithGetIT(String functionCall, String name, Boolean expectedResult) { + super(functionCall, name, expectedResult); + } + + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeFunctionWithGetIT.java new file mode 100644 index 0000000000..e9cef00d15 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeFunctionWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DateTimeFunctionIT tests using http GET request */ +public class DateTimeFunctionWithGetIT extends DateTimeFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeImplementationWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeImplementationWithGetIT.java new file mode 100644 index 0000000000..c40856d221 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeImplementationWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DateTimeImplementationIT tests using http GET request */ +public class DateTimeImplementationWithGetIT extends DateTimeImplementationIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DedupCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DedupCommandWithGetIT.java new file mode 100644 index 0000000000..8092dd716f --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DedupCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DedupCommandIT tests using http GET request */ +public class DedupCommandWithGetIT extends DedupCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/DescribeCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/DescribeCommandWithGetIT.java new file mode 100644 index 0000000000..33e2672663 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/DescribeCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run DescribeCommandIT tests using http GET request */ +public class DescribeCommandWithGetIT extends DescribeCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainWithGetIT.java new file mode 100644 index 0000000000..77cfdb9e55 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ExplainIT tests using http GET request */ +public class ExplainWithGetIT extends ExplainIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/FieldsCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/FieldsCommandWithGetIT.java new file mode 100644 index 0000000000..01e47110e7 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/FieldsCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run FieldsCommandIT tests using http GET request */ +public class FieldsCommandWithGetIT extends FieldsCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/HeadCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/HeadCommandWithGetIT.java new file mode 100644 index 0000000000..87dd114aec --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/HeadCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run HeadCommandIT tests using http GET request */ +public class HeadCommandWithGetIT extends HeadCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java new file mode 100644 index 0000000000..0a83893e3f --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run InformationSchemaCommandIT tests using http GET request */ +public class InformationSchemaCommandWithGetIT extends InformationSchemaCommandIT { + @Override + protected void init() throws InterruptedException, IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/LegacyAPICompatibilityWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/LegacyAPICompatibilityWithGetIT.java new file mode 100644 index 0000000000..7cbf9965f7 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/LegacyAPICompatibilityWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run LegacyAPICompatibilityIT tests using http GET request */ +public class LegacyAPICompatibilityWithGetIT extends LegacyAPICompatibilityIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/LikeQueryWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/LikeQueryWithGetIT.java new file mode 100644 index 0000000000..65845ae52d --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/LikeQueryWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run LikeQueryIT tests using http GET request */ +public class LikeQueryWithGetIT extends LikeQueryIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MatchBoolPrefixWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchBoolPrefixWithGetIT.java new file mode 100644 index 0000000000..9190b61dca --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchBoolPrefixWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run MatchBoolPrefixIT tests using http GET request */ +public class MatchBoolPrefixWithGetIT extends MatchBoolPrefixIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhrasePrefixWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhrasePrefixWithGetIT.java new file mode 100644 index 0000000000..3d0c513dc3 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhrasePrefixWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run MatchPhrasePrefixIT tests using http GET request */ +public class MatchPhrasePrefixWithGetIT extends MatchPhrasePrefixIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhraseWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhraseWithGetIT.java new file mode 100644 index 0000000000..0902444321 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchPhraseWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run MatchPhraseIT tests using http GET request */ +public class MatchPhraseWithGetIT extends MatchPhraseIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MatchWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchWithGetIT.java new file mode 100644 index 0000000000..6d06e3ce0b --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MatchWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run MatchIT tests using http GET request */ +public class MatchWithGetIT extends MatchIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MathematicalFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MathematicalFunctionWithGetIT.java new file mode 100644 index 0000000000..d333d679d0 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MathematicalFunctionWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run MathematicalFunctionIT tests using http GET request */ +public class MathematicalFunctionWithGetIT extends MathematicalFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsWithGetIT.java new file mode 100644 index 0000000000..777d976d2b --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsWithGetIT.java @@ -0,0 +1,17 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import org.opensearch.rest.RestRequest; + +/** Run MetricsIT tests using http GET request */ +public class MetricsWithGetIT extends MetricsIT { + @Override + public void init() throws Exception { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MultiMatchWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MultiMatchWithGetIT.java new file mode 100644 index 0000000000..0e7866ef11 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MultiMatchWithGetIT.java @@ -0,0 +1,31 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BEER; + +import java.io.IOException; +import org.junit.Test; +import org.opensearch.rest.RestRequest; + +/** Run MultiMatchIT tests using http GET request */ +public class MultiMatchWithGetIT extends MultiMatchIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } + + @Test + public void test_multi_match() throws IOException { + String query = + "SOURCE=" + + TEST_INDEX_BEER + + " | WHERE multi_match(['Tags' ^ 1.5, Title, 'Body' 4.2], 'taste') | fields Id"; + var result = executeQuery(query); + assertEquals(16, result.getInt("total")); + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/NowLikeFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/NowLikeFunctionWithGetIT.java new file mode 100644 index 0000000000..a949ab8cc0 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/NowLikeFunctionWithGetIT.java @@ -0,0 +1,32 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.util.function.BiFunction; +import java.util.function.Supplier; +import org.opensearch.rest.RestRequest; + +/** Run NowLikeFunctionIT tests using http GET request */ +public class NowLikeFunctionWithGetIT extends NowLikeFunctionIT { + public NowLikeFunctionWithGetIT( + String name, + Boolean hasFsp, + Boolean hasShortcut, + Boolean constValue, + Supplier referenceGetter, + BiFunction parser, + String serializationPatternStr) { + super(name, hasFsp, hasShortcut, constValue, referenceGetter, parser, serializationPatternStr); + } + + @Override + public void init() throws Exception { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ObjectFieldOperateWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ObjectFieldOperateWithGetIT.java new file mode 100644 index 0000000000..da1501a4ec --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ObjectFieldOperateWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ObjectFieldOperateIT tests using http GET request */ +public class ObjectFieldOperateWithGetIT extends ObjectFieldOperateIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/OperatorWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/OperatorWithGetIT.java new file mode 100644 index 0000000000..a4f98f771f --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/OperatorWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run OperatorIT tests using http GET request */ +public class OperatorWithGetIT extends OperatorIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java b/integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java index 459788021d..f13106a8c3 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java @@ -6,6 +6,7 @@ package org.opensearch.sql.ppl; import static org.opensearch.sql.legacy.TestUtils.getResponseBody; +import static org.opensearch.sql.plugin.request.PPLQueryRequestFactory.PPL_URL_PARAM_KEY; import static org.opensearch.sql.plugin.rest.RestPPLQueryAction.EXPLAIN_API_ENDPOINT; import static org.opensearch.sql.plugin.rest.RestPPLQueryAction.QUERY_API_ENDPOINT; @@ -17,10 +18,12 @@ import org.opensearch.client.Request; import org.opensearch.client.RequestOptions; import org.opensearch.client.Response; +import org.opensearch.rest.RestRequest; import org.opensearch.sql.legacy.SQLIntegTestCase; /** OpenSearch Rest integration test base for PPL testing. */ public abstract class PPLIntegTestCase extends SQLIntegTestCase { + protected RestRequest.Method method = RestRequest.Method.POST; protected JSONObject executeQuery(String query) throws IOException { return jsonify(executeQueryToString(query)); @@ -53,6 +56,16 @@ protected String executeCsvQuery(String query) throws IOException { } protected Request buildRequest(String query, String endpoint) { + switch (method) { + case GET: + return buildGETRequest(query, endpoint); + case POST: + default: + return buildPOSTRequest(query, endpoint); + } + } + + private Request buildPOSTRequest(String query, String endpoint) { Request request = new Request("POST", endpoint); request.setJsonEntity(String.format(Locale.ROOT, "{\n" + " \"query\": \"%s\"\n" + "}", query)); @@ -62,6 +75,16 @@ protected Request buildRequest(String query, String endpoint) { return request; } + private Request buildGETRequest(String query, String endpoint) { + Request request = new Request("GET", endpoint); + request.addParameter(PPL_URL_PARAM_KEY, query); + + RequestOptions.Builder restOptionsBuilder = RequestOptions.DEFAULT.toBuilder(); + restOptionsBuilder.addHeader("Content-Type", "application/json"); + request.setOptions(restOptionsBuilder); + return request; + } + protected static JSONObject updateClusterSettings(ClusterSetting setting) throws IOException { Request request = new Request("PUT", "/_cluster/settings"); String persistentSetting = diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ParseCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ParseCommandWithGetIT.java new file mode 100644 index 0000000000..5627f464c6 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ParseCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ParseCommandIT tests using http GET request */ +public class ParseCommandWithGetIT extends ParseCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/PositionFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/PositionFunctionWithGetIT.java new file mode 100644 index 0000000000..83c4cd4053 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/PositionFunctionWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run PositionFunctionIT tests using http GET request */ +public class PositionFunctionWithGetIT extends PositionFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java new file mode 100644 index 0000000000..04f1e5018b --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run PrometheusDataSourceCommandsIT tests using http GET request */ +public class PrometheusDataSourceCommandsWithGetIT extends PrometheusDataSourceCommandsIT { + @Override + protected void init() throws InterruptedException, IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/QueryAnalysisWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryAnalysisWithGetIT.java new file mode 100644 index 0000000000..e885d98a0c --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryAnalysisWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run QueryAnalysisIT tests using http GET request */ +public class QueryAnalysisWithGetIT extends QueryAnalysisIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java new file mode 100644 index 0000000000..9fcca7fc32 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run QueryStringIT tests using http GET request */ +public class QueryStringWithGetIT extends QueryStringIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/RareCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/RareCommandWithGetIT.java new file mode 100644 index 0000000000..0939c323d0 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/RareCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run RareCommandIT tests using http GET request */ +public class RareCommandWithGetIT extends RareCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/RelevanceFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/RelevanceFunctionWithGetIT.java new file mode 100644 index 0000000000..9b2a098806 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/RelevanceFunctionWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run RelevanceFunctionIT tests using http GET request */ +public class RelevanceFunctionWithGetIT extends RelevanceFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/RenameCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/RenameCommandWithGetIT.java new file mode 100644 index 0000000000..7a921152c0 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/RenameCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ConvertTZFunctionIT tests using http GET request */ +public class RenameCommandWithGetIT extends RenameCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ResourceMonitorWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ResourceMonitorWithGetIT.java new file mode 100644 index 0000000000..5d936c44f8 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ResourceMonitorWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ResourceMonitorIT tests using http GET request */ +public class ResourceMonitorWithGetIT extends ResourceMonitorIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SearchCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SearchCommandWithGetIT.java new file mode 100644 index 0000000000..34ab43dfa7 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SearchCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run SearchCommandIT tests using http GET request */ +public class SearchCommandWithGetIT extends SearchCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SettingsWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SettingsWithGetIT.java new file mode 100644 index 0000000000..d20bd3715e --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SettingsWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run SettingsIT tests using http GET request */ +public class SettingsWithGetIT extends SettingsIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ShowDataSourcesCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ShowDataSourcesCommandWithGetIT.java new file mode 100644 index 0000000000..f63c38db36 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ShowDataSourcesCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run ShowDataSourcesCommandIT tests using http GET request */ +public class ShowDataSourcesCommandWithGetIT extends ShowDataSourcesCommandIT { + @Override + protected void init() throws InterruptedException, IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java new file mode 100644 index 0000000000..7ac74983e4 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run SimpleQueryStringIT tests using http GET request */ +public class SimpleQueryStringWithGetIT extends SimpleQueryStringIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SortCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SortCommandWithGetIT.java new file mode 100644 index 0000000000..6f5453360f --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SortCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run SortCommandIT tests using http GET request */ +public class SortCommandWithGetIT extends SortCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/StatsCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/StatsCommandWithGetIT.java new file mode 100644 index 0000000000..79c6347ca1 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/StatsCommandWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run StatsCommandIT tests using http GET request */ +public class StatsCommandWithGetIT extends StatsCommandIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SystemFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SystemFunctionWithGetIT.java new file mode 100644 index 0000000000..8f56fcd886 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SystemFunctionWithGetIT.java @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import java.io.IOException; +import org.opensearch.rest.RestRequest; + +/** Run SystemFunctionIT tests using http GET request */ +public class SystemFunctionWithGetIT extends SystemFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = RestRequest.Method.GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/TextFunctionWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/TextFunctionWithGetIT.java new file mode 100644 index 0000000000..50d5b341c1 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/TextFunctionWithGetIT.java @@ -0,0 +1,19 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import static org.opensearch.rest.RestRequest.Method.GET; + +import java.io.IOException; + +/** Run TextFunctionIT tests using http GET request */ +public class TextFunctionWithGetIT extends TextFunctionIT { + @Override + public void init() throws IOException { + super.init(); + this.method = GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/TopCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/TopCommandWithGetIT.java new file mode 100644 index 0000000000..0976f40bcb --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/TopCommandWithGetIT.java @@ -0,0 +1,20 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import static org.opensearch.rest.RestRequest.Method.GET; + +import java.io.IOException; + +/** Run TopCommandIT tests using http GET request */ +public class TopCommandWithGetIT extends TopCommandIT { + + @Override + public void init() throws IOException { + super.init(); + this.method = GET; + } +} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/WhereCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/WhereCommandWithGetIT.java new file mode 100644 index 0000000000..8025b161a4 --- /dev/null +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/WhereCommandWithGetIT.java @@ -0,0 +1,20 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.opensearch.sql.ppl; + +import static org.opensearch.rest.RestRequest.Method.GET; + +import java.io.IOException; + +/** Run WhereCommandIT tests using http GET request */ +public class WhereCommandWithGetIT extends WhereCommandIT { + + @Override + public void init() throws IOException { + super.init(); + this.method = GET; + } +} diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/request/PPLQueryRequestFactory.java b/plugin/src/main/java/org/opensearch/sql/plugin/request/PPLQueryRequestFactory.java index ad734bf150..3a4c23044b 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/request/PPLQueryRequestFactory.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/request/PPLQueryRequestFactory.java @@ -16,7 +16,7 @@ /** Factory of {@link PPLQueryRequest}. */ public class PPLQueryRequestFactory { - private static final String PPL_URL_PARAM_KEY = "ppl"; + public static final String PPL_URL_PARAM_KEY = "ppl"; private static final String PPL_FIELD_NAME = "query"; private static final String QUERY_PARAMS_FORMAT = "format"; private static final String QUERY_PARAMS_SANITIZE = "sanitize"; @@ -43,7 +43,6 @@ public static PPLQueryRequest getPPLRequest(RestRequest request) { private static PPLQueryRequest parsePPLRequestFromUrl(RestRequest restRequest) { String ppl; - ppl = restRequest.param(PPL_URL_PARAM_KEY); if (ppl == null) { throw new IllegalArgumentException("Cannot find ppl parameter from the URL"); diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java index d35962be91..d7e04b0686 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java @@ -76,9 +76,15 @@ public List replacedRoutes() { new ReplacedRoute( RestRequest.Method.POST, QUERY_API_ENDPOINT, RestRequest.Method.POST, LEGACY_QUERY_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.GET, QUERY_API_ENDPOINT, + RestRequest.Method.GET, LEGACY_QUERY_API_ENDPOINT), new ReplacedRoute( RestRequest.Method.POST, EXPLAIN_API_ENDPOINT, - RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT)); + RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.GET, EXPLAIN_API_ENDPOINT, + RestRequest.Method.GET, LEGACY_EXPLAIN_API_ENDPOINT)); } @Override diff --git a/spark/src/main/antlr/SqlBaseLexer.g4 b/spark/src/main/antlr/SqlBaseLexer.g4 index 9b3dcbc6d1..174887def6 100644 --- a/spark/src/main/antlr/SqlBaseLexer.g4 +++ b/spark/src/main/antlr/SqlBaseLexer.g4 @@ -217,6 +217,7 @@ HOURS: 'HOURS'; IDENTIFIER_KW: 'IDENTIFIER'; IF: 'IF'; IGNORE: 'IGNORE'; +IMMEDIATE: 'IMMEDIATE'; IMPORT: 'IMPORT'; IN: 'IN'; INCLUDE: 'INCLUDE'; @@ -381,6 +382,7 @@ TIMESTAMPADD: 'TIMESTAMPADD'; TIMESTAMPDIFF: 'TIMESTAMPDIFF'; TINYINT: 'TINYINT'; TO: 'TO'; +EXECUTE: 'EXECUTE'; TOUCH: 'TOUCH'; TRAILING: 'TRAILING'; TRANSACTION: 'TRANSACTION'; diff --git a/spark/src/main/antlr/SqlBaseParser.g4 b/spark/src/main/antlr/SqlBaseParser.g4 index 439a12c301..737d5196e7 100644 --- a/spark/src/main/antlr/SqlBaseParser.g4 +++ b/spark/src/main/antlr/SqlBaseParser.g4 @@ -72,6 +72,7 @@ singleTableSchema statement : query #statementDefault + | executeImmediate #visitExecuteImmediate | ctes? dmlStatementNoWith #dmlStatement | USE identifierReference #use | USE namespace identifierReference #useNamespace @@ -230,6 +231,28 @@ statement | unsupportedHiveNativeCommands .*? #failNativeCommand ; +executeImmediate + : EXECUTE IMMEDIATE queryParam=executeImmediateQueryParam (INTO targetVariable=multipartIdentifierList)? executeImmediateUsing? + ; + +executeImmediateUsing + : USING LEFT_PAREN params=namedExpressionSeq RIGHT_PAREN + | USING params=namedExpressionSeq + ; + +executeImmediateQueryParam + : stringLit + | multipartIdentifier + ; + +executeImmediateArgument + : (constant|multipartIdentifier) (AS name=errorCapturingIdentifier)? + ; + +executeImmediateArgumentSeq + : executeImmediateArgument (COMMA executeImmediateArgument)* + ; + timezone : stringLit | LOCAL @@ -979,6 +1002,7 @@ primaryExpression | LEFT_PAREN query RIGHT_PAREN #subqueryExpression | functionName LEFT_PAREN (setQuantifier? argument+=functionArgument (COMMA argument+=functionArgument)*)? RIGHT_PAREN + (WITHIN GROUP LEFT_PAREN ORDER BY sortItem (COMMA sortItem)* RIGHT_PAREN)? (FILTER LEFT_PAREN WHERE where=booleanExpression RIGHT_PAREN)? (nullsOption=(IGNORE | RESPECT) NULLS)? ( OVER windowSpec)? #functionCall | identifier ARROW expression #lambda @@ -994,9 +1018,6 @@ primaryExpression FROM srcStr=valueExpression RIGHT_PAREN #trim | OVERLAY LEFT_PAREN input=valueExpression PLACING replace=valueExpression FROM position=valueExpression (FOR length=valueExpression)? RIGHT_PAREN #overlay - | name=(PERCENTILE_CONT | PERCENTILE_DISC) LEFT_PAREN percentage=valueExpression RIGHT_PAREN - WITHIN GROUP LEFT_PAREN ORDER BY sortItem RIGHT_PAREN - (FILTER LEFT_PAREN WHERE where=booleanExpression RIGHT_PAREN)? ( OVER windowSpec)? #percentile ; literalType @@ -1396,6 +1417,7 @@ ansiNonReserved | IDENTIFIER_KW | IF | IGNORE + | IMMEDIATE | IMPORT | INCLUDE | INDEX @@ -1687,6 +1709,7 @@ nonReserved | ESCAPED | EXCHANGE | EXCLUDE + | EXECUTE | EXISTS | EXPLAIN | EXPORT @@ -1719,6 +1742,7 @@ nonReserved | IDENTIFIER_KW | IF | IGNORE + | IMMEDIATE | IMPORT | IN | INCLUDE From 4e3f53aaa9ca6a044dc518da43f155750d486e5c Mon Sep 17 00:00:00 2001 From: YANGDB Date: Mon, 1 Jan 2024 23:28:47 -0800 Subject: [PATCH 5/7] fix failed tests Signed-off-by: YANGDB --- .../opensearch/sql/ppl/QueryStringWithGetIT.java | 13 +++++++++++++ .../sql/ppl/SimpleQueryStringWithGetIT.java | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java index 9fcca7fc32..59386b3b17 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/QueryStringWithGetIT.java @@ -5,7 +5,10 @@ package org.opensearch.sql.ppl; +import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BEER; + import java.io.IOException; +import org.json.JSONObject; import org.opensearch.rest.RestRequest; /** Run QueryStringIT tests using http GET request */ @@ -15,4 +18,14 @@ public void init() throws IOException { super.init(); this.method = RestRequest.Method.GET; } + + @Override + public void mandatory_params_test() throws IOException { + String query = + "source=" + + TEST_INDEX_BEER + + " | where query_string(['Tags' ^ 1.5, Title, 'Body' 4.2], 'taste')"; + JSONObject result = executeQuery(query); + assertEquals(16, result.getInt("total")); + } } diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java index 7ac74983e4..58d044f8b4 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/SimpleQueryStringWithGetIT.java @@ -5,7 +5,10 @@ package org.opensearch.sql.ppl; +import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BEER; + import java.io.IOException; +import org.junit.Test; import org.opensearch.rest.RestRequest; /** Run SimpleQueryStringIT tests using http GET request */ @@ -15,4 +18,15 @@ public void init() throws IOException { super.init(); this.method = RestRequest.Method.GET; } + + @Test + public void test_simple_query_string() throws IOException { + String query = + "SOURCE=" + + TEST_INDEX_BEER + + " | WHERE simple_query_string(['Tags' ^ 1.5, Title, 'Body' 4.2], 'taste') |" + + " fields Id"; + var result = executeQuery(query); + assertEquals(16, result.getInt("total")); + } } From 07904be2003c2de6687b90bd0388850f07f7390e Mon Sep 17 00:00:00 2001 From: YANGDB Date: Tue, 2 Jan 2024 00:02:01 -0800 Subject: [PATCH 6/7] remove redundant Prometheus IT test Signed-off-by: YANGDB --- .../ppl/InformationSchemaCommandWithGetIT.java | 18 ------------------ .../PrometheusDataSourceCommandsWithGetIT.java | 18 ------------------ 2 files changed, 36 deletions(-) delete mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java delete mode 100644 integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java deleted file mode 100644 index 0a83893e3f..0000000000 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/InformationSchemaCommandWithGetIT.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.sql.ppl; - -import java.io.IOException; -import org.opensearch.rest.RestRequest; - -/** Run InformationSchemaCommandIT tests using http GET request */ -public class InformationSchemaCommandWithGetIT extends InformationSchemaCommandIT { - @Override - protected void init() throws InterruptedException, IOException { - super.init(); - this.method = RestRequest.Method.GET; - } -} diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java deleted file mode 100644 index 04f1e5018b..0000000000 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusDataSourceCommandsWithGetIT.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.sql.ppl; - -import java.io.IOException; -import org.opensearch.rest.RestRequest; - -/** Run PrometheusDataSourceCommandsIT tests using http GET request */ -public class PrometheusDataSourceCommandsWithGetIT extends PrometheusDataSourceCommandsIT { - @Override - protected void init() throws InterruptedException, IOException { - super.init(); - this.method = RestRequest.Method.GET; - } -} From 917b8417015c15f431b3b7ceceb2cb2f268e257f Mon Sep 17 00:00:00 2001 From: YANGDB Date: Mon, 8 Jan 2024 11:48:39 -0800 Subject: [PATCH 7/7] remove un-needed grammar from 2.X version Signed-off-by: YANGDB --- spark/src/main/antlr/SqlBaseLexer.g4 | 2 -- spark/src/main/antlr/SqlBaseParser.g4 | 30 +++------------------------ 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/spark/src/main/antlr/SqlBaseLexer.g4 b/spark/src/main/antlr/SqlBaseLexer.g4 index 174887def6..9b3dcbc6d1 100644 --- a/spark/src/main/antlr/SqlBaseLexer.g4 +++ b/spark/src/main/antlr/SqlBaseLexer.g4 @@ -217,7 +217,6 @@ HOURS: 'HOURS'; IDENTIFIER_KW: 'IDENTIFIER'; IF: 'IF'; IGNORE: 'IGNORE'; -IMMEDIATE: 'IMMEDIATE'; IMPORT: 'IMPORT'; IN: 'IN'; INCLUDE: 'INCLUDE'; @@ -382,7 +381,6 @@ TIMESTAMPADD: 'TIMESTAMPADD'; TIMESTAMPDIFF: 'TIMESTAMPDIFF'; TINYINT: 'TINYINT'; TO: 'TO'; -EXECUTE: 'EXECUTE'; TOUCH: 'TOUCH'; TRAILING: 'TRAILING'; TRANSACTION: 'TRANSACTION'; diff --git a/spark/src/main/antlr/SqlBaseParser.g4 b/spark/src/main/antlr/SqlBaseParser.g4 index 737d5196e7..439a12c301 100644 --- a/spark/src/main/antlr/SqlBaseParser.g4 +++ b/spark/src/main/antlr/SqlBaseParser.g4 @@ -72,7 +72,6 @@ singleTableSchema statement : query #statementDefault - | executeImmediate #visitExecuteImmediate | ctes? dmlStatementNoWith #dmlStatement | USE identifierReference #use | USE namespace identifierReference #useNamespace @@ -231,28 +230,6 @@ statement | unsupportedHiveNativeCommands .*? #failNativeCommand ; -executeImmediate - : EXECUTE IMMEDIATE queryParam=executeImmediateQueryParam (INTO targetVariable=multipartIdentifierList)? executeImmediateUsing? - ; - -executeImmediateUsing - : USING LEFT_PAREN params=namedExpressionSeq RIGHT_PAREN - | USING params=namedExpressionSeq - ; - -executeImmediateQueryParam - : stringLit - | multipartIdentifier - ; - -executeImmediateArgument - : (constant|multipartIdentifier) (AS name=errorCapturingIdentifier)? - ; - -executeImmediateArgumentSeq - : executeImmediateArgument (COMMA executeImmediateArgument)* - ; - timezone : stringLit | LOCAL @@ -1002,7 +979,6 @@ primaryExpression | LEFT_PAREN query RIGHT_PAREN #subqueryExpression | functionName LEFT_PAREN (setQuantifier? argument+=functionArgument (COMMA argument+=functionArgument)*)? RIGHT_PAREN - (WITHIN GROUP LEFT_PAREN ORDER BY sortItem (COMMA sortItem)* RIGHT_PAREN)? (FILTER LEFT_PAREN WHERE where=booleanExpression RIGHT_PAREN)? (nullsOption=(IGNORE | RESPECT) NULLS)? ( OVER windowSpec)? #functionCall | identifier ARROW expression #lambda @@ -1018,6 +994,9 @@ primaryExpression FROM srcStr=valueExpression RIGHT_PAREN #trim | OVERLAY LEFT_PAREN input=valueExpression PLACING replace=valueExpression FROM position=valueExpression (FOR length=valueExpression)? RIGHT_PAREN #overlay + | name=(PERCENTILE_CONT | PERCENTILE_DISC) LEFT_PAREN percentage=valueExpression RIGHT_PAREN + WITHIN GROUP LEFT_PAREN ORDER BY sortItem RIGHT_PAREN + (FILTER LEFT_PAREN WHERE where=booleanExpression RIGHT_PAREN)? ( OVER windowSpec)? #percentile ; literalType @@ -1417,7 +1396,6 @@ ansiNonReserved | IDENTIFIER_KW | IF | IGNORE - | IMMEDIATE | IMPORT | INCLUDE | INDEX @@ -1709,7 +1687,6 @@ nonReserved | ESCAPED | EXCHANGE | EXCLUDE - | EXECUTE | EXISTS | EXPLAIN | EXPORT @@ -1742,7 +1719,6 @@ nonReserved | IDENTIFIER_KW | IF | IGNORE - | IMMEDIATE | IMPORT | IN | INCLUDE