Repository navigation
Implementation of simple_query_string - #54
Closed
Yury-Fridlyand wants to merge 3 commits into
Closed
Yury-Fridlyand wants to merge 3 commits into
Yury-Fridlyand wants to merge 3 commits into
Conversation
Signed-off-by: Yury Fridlyand <[email protected]>
Signed-off-by: Yury Fridlyand <[email protected]>
Signed-off-by: Yury Fridlyand <[email protected]>
1 of 6 tasks
Yury-Fridlyand
commented
May 12, 2022
| private static FunctionResolver simple_query_string() { | ||
| FunctionName funcName = BuiltinFunctionName.SIMPLE_QUERY_STRING.getName(); | ||
| // At most field, query, and all optional parameters | ||
| // TODO 16 ? See org.opensearch.index.query.SimpleQueryStringBuilder.class |
Yury-Fridlyand
commented
May 12, 2022
| } | ||
| } | ||
| } | ||
| } No newline at end of file |
|
|
||
| var lst = arr.toList().stream().map(String::valueOf).collect(Collectors.toList()); | ||
| var res = new HashMap<String, Float>(); | ||
| //var builder = ImmutableMap.builder(); |
Author
There was a problem hiding this comment.
Should we use ImmutableMap? The return value has to be Map<String, Float>, so in that case we need to convert immutable map to mutable one.
Comment on lines
+110
to
+112
| var parts = elem.split("\\^"); | ||
| var weight = Float.parseFloat(parts[parts.length - 1]); | ||
| var field = Arrays.stream(parts).limit(parts.length - 1).collect(Collectors.joining("^")); |
Author
There was a problem hiding this comment.
- Should we support multiple
^character? - The exception message would be unclear for the end user if string ends with
^or there is no float after^. ^may be a part of the string, so it should be escaped.
acarbonetto
reviewed
May 12, 2022
| private Map<String, Float> parseFields(String fields) { | ||
| try { | ||
| // TODO support elements wrapped by single quotes | ||
| var arr = new JSONArray(fields); |
There was a problem hiding this comment.
Teh JSON parser doesn't work for 2 reasons:
- it doesn't support single quotes
- it doesn't parse the carot (^) character.
We should consider abandoning this direction and using the lex parser to read the array.
Author
|
Closed as of #61. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Backend implementation of
simple_query_stringfunction, see opensearch-project#192Require SQL/PPL parser update (#53) to support end-to-end flow
TODOs:
Issues Resolved
^
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.