forked from opensearch-project/sql
-
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
Implementation for simple_query_string
.
#61
Closed
Yury-Fridlyand
wants to merge
43
commits into
dev-simple_query_string-#192
from
dev-simple_query_string-#192-impl2
Closed
Changes from 16 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
a422774
Support MATCH_BOOL_PREFIX in SQL parser.
838da0f
Add an interface for PPL and SQL parsers.
5b346ea
Implementation for `simple_query_string`.
Yury-Fridlyand f57429c
Implement Parser interface on PPLSyntaxParser.
e80a334
Add base class for all SQL tests.
531f31c
Add match_bool_prefix to list of known functions.
1b85a9e
Add match_bool_prefix to DSL.
dd4f77b
Add MatchBoolPrefixQuery query builder.
1ba94d9
Add MatchBoolPrefixQuery to FilterQueryBuilder.
a51c0ca
Fix code style.
Yury-Fridlyand 1855e39
Address PR comments.
4321fc1
100% unit test coverage for RelevanceQuery class.
92087d9
Add integration test for match_bool_prefix in SQL.
c8a5da2
Renaming to make code clearer.
Yury-Fridlyand 94748b5
Fix parser to accept strings only for field.
Yury-Fridlyand d5def08
Fix tests according to the parser update.
Yury-Fridlyand 3a36a0f
Add DSL test.
Yury-Fridlyand 2b4a99b
Remaning to fit code standard.
Yury-Fridlyand 84d84e1
Typo fix.
Yury-Fridlyand d379af2
Typo fix for `c8a5da2`.
Yury-Fridlyand 56ead1b
Enable MatchBoolPrefixParserTest tests since they now pass.
bea74fe
Update parser syntax. Rework on field list as on 2D array.
Yury-Fridlyand 4ae2375
Next iteration on `simple_query_string`.
Yury-Fridlyand ebf563c
Simplify processing of `RelevanceFieldList`.
Yury-Fridlyand a149dd7
Add user documentation for match_bool_prefix.
5ccadd5
Merge from upstream/main and resolve conflicts.
b879b03
ANTLR: Extend list of relenvace function arguments.
Yury-Fridlyand a7b0a8c
Small optimization in AST processing. Code clean-up. Added argument c…
Yury-Fridlyand 4e43ccd
Add parser tests.
Yury-Fridlyand a641212
Add rest unit and DSL tests.
Yury-Fridlyand b2639e3
Add integration tests.
Yury-Fridlyand f7923ee
Add doctest.
Yury-Fridlyand 33edff4
Update test notes.
Yury-Fridlyand 7c3ff71
Merge remote-tracking branch 'origin/opensearch-project-main' into de…
Yury-Fridlyand b3bf2c8
Fix legacy test compilation errors, gradle task `:legacy:compileTestJ…
Yury-Fridlyand 928faf5
Fix merge errors.
Yury-Fridlyand 5541d95
Code style.
Yury-Fridlyand de179c3
Rework `SimpleQueryStringQuery` to use the `RelevanceFunction` interf…
Yury-Fridlyand a9d5c19
Add more unit tests and test notes.
Yury-Fridlyand 65ec516
Fix merge errors in legacy test. Revert `b3bf2c8`.
Yury-Fridlyand 71bf20c
Minor optimizations according to PR feedback.
Yury-Fridlyand 048984c
Fix flakyness of regular `Map` (`HashMap`), by replacing it with `Imm…
Yury-Fridlyand cba5749
Revert merge with `opensearch-project-main`, commit `7c3ff71`.
Yury-Fridlyand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -342,6 +342,17 @@ public void named_non_parse_expression() { | |
assertAnalyzeEqual(DSL.ref("string_field", STRING), qualifiedName("string_field")); | ||
} | ||
|
||
@Test | ||
void match_bool_prefix_expression() { | ||
assertAnalyzeEqual( | ||
dsl.match_bool_prefix( | ||
dsl.namedArgument("field", DSL.literal("fieldA")), | ||
dsl.namedArgument("query", DSL.literal("sample query"))), | ||
AstDSL.function("match_bool_prefix", | ||
AstDSL.unresolvedArg("field", stringLiteral("fieldA")), | ||
AstDSL.unresolvedArg("query", stringLiteral("sample query")))); | ||
} | ||
|
||
@Test | ||
void visit_span() { | ||
assertAnalyzeEqual( | ||
|
@@ -394,8 +405,8 @@ void simple_query_string_expression_with_params() { | |
} | ||
|
||
@Test | ||
// Test is disabled because DSL and AstDSL expressions always has fields in the different order | ||
// regardless of how they are specified | ||
// Test is disabled because DSL and AstDSL expressions sometimes has fields in the different order | ||
// regardless of how they are specified. Test passes and fails in a flaky behavior. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unfortunate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 048984c. |
||
@Disabled | ||
void simple_query_string_expression_two_fields() { | ||
assertAnalyzeEqual( | ||
|
@@ -406,8 +417,8 @@ void simple_query_string_expression_two_fields() { | |
dsl.namedArgument("query", DSL.literal("sample query"))), | ||
AstDSL.function("simple_query_string", | ||
AstDSL.unresolvedArg("fields", new RelevanceFieldList(Map.of( | ||
stringLiteral("field2"), floatLiteral(.3F), | ||
stringLiteral("field1"), floatLiteral(1.F)))), | ||
stringLiteral("field1"), floatLiteral(1.F), | ||
stringLiteral("field2"), floatLiteral(.3F)))), | ||
AstDSL.unresolvedArg("query", stringLiteral("sample 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we do this?
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.
It is caused by the merge. Fixed in cba5749, the merge was reverted.