-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into integ-match_phrase_…
…prefix-#186 Signed-off-by: MaxKsyunz <maxk@bitquilltech.com> # Conflicts: # core/src/main/java/org/opensearch/sql/expression/function/BuiltinFunctionName.java # docs/user/dql/functions.rst # opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilder.java # ppl/src/main/antlr/OpenSearchPPLLexer.g4 # ppl/src/main/antlr/OpenSearchPPLParser.g4 # sql/src/main/antlr/OpenSearchSQLParser.g4
- Loading branch information
Showing
47 changed files
with
842 additions
and
125 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
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
7 changes: 7 additions & 0 deletions
7
common/src/main/java/org/opensearch/sql/common/antlr/Parser.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,7 @@ | ||
package org.opensearch.sql.common.antlr; | ||
|
||
import org.antlr.v4.runtime.tree.ParseTree; | ||
|
||
public interface Parser { | ||
ParseTree parse(String query); | ||
} |
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
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
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
59 changes: 59 additions & 0 deletions
59
integ-test/src/test/java/org/opensearch/sql/ppl/MatchBoolPrefixIT.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,59 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ppl; | ||
|
||
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_PHRASE; | ||
import static org.opensearch.sql.util.MatcherUtils.rows; | ||
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows; | ||
|
||
import java.io.IOException; | ||
import org.json.JSONObject; | ||
import org.junit.Test; | ||
|
||
public class MatchBoolPrefixIT extends PPLIntegTestCase { | ||
|
||
@Override | ||
public void init() throws IOException { | ||
loadIndex(Index.PHRASE); | ||
} | ||
|
||
@Test | ||
public void valid_query_match_test() throws IOException { | ||
JSONObject result = | ||
executeQuery( | ||
String.format( | ||
"source=%s | where match_bool_prefix(phrase, 'qui') | fields phrase", | ||
TEST_INDEX_PHRASE)); | ||
|
||
verifyDataRows(result, | ||
rows("quick fox"), | ||
rows("quick fox here")); | ||
} | ||
|
||
@Test | ||
public void optional_parameter_match_test() throws IOException { | ||
JSONObject result = | ||
executeQuery( | ||
String.format( | ||
"source=%s | where match_bool_prefix(phrase, '2 tes', minimum_should_match=1, fuzziness=2) | fields phrase", | ||
TEST_INDEX_PHRASE)); | ||
|
||
verifyDataRows(result, | ||
rows("my test"), | ||
rows("my test 2")); | ||
} | ||
|
||
@Test | ||
public void no_matches_test() throws IOException { | ||
JSONObject result = | ||
executeQuery( | ||
String.format( | ||
"source=%s | where match_bool_prefix(phrase, 'rice') | fields phrase", | ||
TEST_INDEX_PHRASE)); | ||
|
||
assertEquals(0, result.getInt("total")); | ||
} | ||
} |
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
Oops, something went wrong.