-
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
Improve Error Reporting for New SQL Engine #88
Improve Error Reporting for New SQL Engine #88
Conversation
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSQLQueryAction.java
Show resolved
Hide resolved
private void reportError(final RestChannel channel, final Exception e, final RestStatus status, String newSqlEngineError) { | ||
sendResponse(channel, ErrorMessageFactory.createErrorMessage(e, status.getStatus()).toString() + (newSqlEngineError.isEmpty() | ||
? "" : "\nQuery failed both legacy and new SQL engines, see error message below for new SQL engine error.\n" | ||
+ newSqlEngineError), status); |
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.
Putting a conditional within a concat is clunky. I would suggest saving the result of the conditional to a String variable would be cleaner.
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java
Show resolved
Hide resolved
* This member variable and it's usage can be deleted once the | ||
* legacy SQL engine is deprecated. | ||
*/ | ||
private String ErrorStr; |
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.
errorString
- classes capitalize the first letter, not private variables.
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Codecov Report
@@ Coverage Diff @@
## integ-sql_engine_error_improvements #88 +/- ##
=========================================================================
+ Coverage 97.72% 97.74% +0.02%
- Complexity 2816 2859 +43
=========================================================================
Files 271 272 +1
Lines 6934 7006 +72
Branches 439 443 +4
=========================================================================
+ Hits 6776 6848 +72
Misses 157 157
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…race separately in log to avoid logging un-anonymized data. Added function comments Signed-off-by: forestmvey <forestv@bitquilltech.com>
docs/user/admin/settings.rst
Outdated
@@ -109,6 +109,15 @@ Result set:: | |||
}, | |||
"status" : 400 | |||
} | |||
Query failed on both V1 and V2 SQL parser engines. V2 SQL parser error following: | |||
{ | |||
"error": { |
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 think you whitespace is off here
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java
Show resolved
Hide resolved
@@ -39,7 +39,7 @@ public static String anonymizeData(String query) { | |||
.replaceAll("[\\n][\\t]+", " "); | |||
} catch (Exception e) { | |||
LOG.warn("Caught an exception when anonymizing sensitive data"); | |||
resultQuery = query; | |||
resultQuery = "Failed to anonymize data."; |
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.
We should comment why we aren't returning the query any longer
@@ -39,7 +39,7 @@ public static String anonymizeData(String query) { | |||
.replaceAll("[\\n][\\t]+", " "); | |||
} catch (Exception e) { | |||
LOG.warn("Caught an exception when anonymizing sensitive data"); |
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.
Can we add a LOG.debug statement and output the failed query?
…ction Signed-off-by: forestmvey <forestv@bitquilltech.com>
LOG.warn("Caught an exception when anonymizing sensitive data"); | ||
resultQuery = query; | ||
LOG.warn("Caught an exception when anonymizing sensitive data."); | ||
LOG.debug("String {} failed anonymization.", 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.
You still print the query on failure in the log.
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.
Only in debug level which shouldn't be enabled in a production build right?
* Apply lombok Update compile task to recognize lombok Use lombok wherever applicable Use @nonnull notation Use var for local variables Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Description
When a query fails both legacy and new SQL engines, only the legacy engine error is reported to the user. On failure in both the legacy and new SQL engines, error messages from both should be reported to the end user.
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.