-
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
Rework on error reporting to make it more verbose and human-friendly. #116
Rework on error reporting to make it more verbose and human-friendly. #116
Conversation
Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
This comment was marked as spam.
This comment was marked as spam.
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java
Outdated
Show resolved
Hide resolved
Set<String> visitedParms = new HashSet(); | ||
// Aggregate parameters by name, so getting a Map<Name:String, List> | ||
arguments.stream().collect(Collectors.groupingBy(a -> a.getArgName().toLowerCase())) | ||
.forEach((k, v) -> { |
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.
@Yury-Fridlyand asked https://github.com/Bit-Quill/opensearch-project-sql/pull/108/files#r966554640
Do we need to aggregate all duplicates into one exception? Currently, function throws on first found duplicated parameter.
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.
What do we do other places...? I think we always throw on the first failure, but maybe you have an example where we aggregate?
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.
I can't find any examples. I don't think that we should worry about that, the probability that a user will specify multiple arguments more than once is extremely low I suppose. I just pointed that we have a room for further improvement.
private String details; | ||
|
||
public String getDetails() { |
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.
why don't you use @Getter too?
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.
Thank you, fixed in 8423187.
.put("lenient", (b, v) -> b.lenient(Boolean.parseBoolean(v.stringValue()))) | ||
.put("operator", (b, v) -> b.operator(Operator.fromString(v.stringValue()))) | ||
.put("auto_generate_synonyms_phrase_query", (b, v) -> b.autoGenerateSynonymsPhraseQuery( | ||
FunctionParameterRepository.convertBoolValue(v,"auto_generate_synonyms_phrase_query"))) |
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.
FunctionParameterRepository.convertBoolValue(v,"auto_generate_synonyms_phrase_query"))) | |
FunctionParameterRepository.convertBoolValue(v, "auto_generate_synonyms_phrase_query"))) |
.put("analyze_wildcard", (b, v) -> b.analyzeWildcard( | ||
FunctionParameterRepository.convertBoolValue(v, "analyze_wildcard"))) | ||
.put("auto_generate_synonyms_phrase_query", (b, v) -> b.autoGenerateSynonymsPhraseQuery( | ||
FunctionParameterRepository.convertBoolValue(v,"auto_generate_synonyms_phrase_query"))) |
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.
FunctionParameterRepository.convertBoolValue(v,"auto_generate_synonyms_phrase_query"))) | |
FunctionParameterRepository.convertBoolValue(v, "auto_generate_synonyms_phrase_query"))) |
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.
If I add the space, line pass 100 symbols limit and I have to break it. I would like to avoid it, but if you insist...
Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
The query
but the query
returns
EDIT: Seems we could not re-produce this on another machine 😕 |
…#116) Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
…#116) Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
…#116) Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com> Solved Merge Conflicts
…#116) Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Co-authored-by: MaxKsyunz maxk@bitquilltech.com
Co-authored-by: forestmvey forestv@bitquilltech.com
Signed-off-by: Yury-Fridlyand yuryf@bitquilltech.com
Description
Re-creation of PR #108.
Issues Resolved
1.
Added cast validation and user-friendly error messages
before
after
2.
Cast validation and user-friendly errors for all enum types
before
after
3.
Extended error message when incorrect parameters specified
before
after
4.
A bit better error on typo in function name
before
after
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.