-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix sql syntax error user #16583
Fix sql syntax error user #16583
Conversation
@@ -380,13 +380,7 @@ public static DruidException translateException(Exception e) | |||
} | |||
} | |||
|
|||
return DruidException.forPersona(DruidException.Persona.DEVELOPER) |
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.
This makes sense to me since this is still a case of SqlParseException
.
@zachjsh, do you mind adding a test with a bad SQL that would cause the exception to be targeted towards a user?
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.
Added.
// For this reason, we consider these as targetting a more expert persona, i.e. the admin instead of the actual | ||
// user. |
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.
The removed comment provides the reason why it was not target to the USER
; I think we should leave the uncategorized ones to ADMIN
or something
if there is a particular set of exceptions which should be hardened; maybe those should be targeted directly
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 reverted this part of the change, thanks for taking a look!
"Unable to parse the SQL, unrecognized error from calcite: [%s]", | ||
inner.getMessage() | ||
); | ||
return InvalidSqlInput.exception(inner.getMessage()); |
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.
this exception creation clips the stacktrace - it only retains the source exceptions message
Description
This fixes an issue where in some cases, a
SqlParseException
encountered when parsing a query results in an error returned to the user with persona aDEVELOPER
when it should instead beUSER
.This PR has: