Skip to content
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

make planner errors be user persona #17437

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public void testUnionAllWithDifferentColumnNames()
+ "PARTITIONED BY ALL TIME")
.setExpectedValidationErrorMatcher(
new DruidExceptionMatcher(
DruidException.Persona.ADMIN,
DruidException.Persona.USER,
DruidException.Category.INVALID_INPUT,
"general"
).expectMessageContains(
Expand All @@ -533,7 +533,7 @@ public void testTopLevelUnionAllWithJoins()
)
.setExpectedValidationErrorMatcher(
new DruidExceptionMatcher(
DruidException.Persona.ADMIN,
DruidException.Persona.USER,
DruidException.Category.INVALID_INPUT,
"general"
).expectMessageContains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,10 @@ private DruidException buildSQLPlanningError(RelOptPlanner.CannotPlanException e
.build(exception, "Unhandled Query Planning Failure, see broker logs for details");
} else {
// Planning errors are more like hints: it isn't guaranteed that the planning error is actually what went wrong.
// For this reason, we consider these as targetting a more expert persona, i.e. the admin instead of the actual
// user.
throw DruidException.forPersona(DruidException.Persona.ADMIN)
// Even though the errors could be targetted to a more expert persona the errors aren't leaking any privileged
// information about the cluster that an admin might care about. The errors that are user resolvable are worth
// the potential confusion that a user might face with one that requires an expert persona.
throw DruidException.forPersona(DruidException.Persona.USER)
.ofCategory(DruidException.Category.INVALID_INPUT)
.build(
exception,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ private DruidExceptionMatcher buildUnplannableExceptionMatcher()
if (testBuilder().isDecoupledMode()) {
return new DruidExceptionMatcher(Persona.USER, Category.INVALID_INPUT, "invalidInput");
} else {
return new DruidExceptionMatcher(Persona.ADMIN, Category.INVALID_INPUT, "general");
return new DruidExceptionMatcher(Persona.USER, Category.INVALID_INPUT, "general");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ public void testCannotConvert() throws Exception
validateErrorResponse(
exception,
"general",
DruidException.Persona.ADMIN,
DruidException.Persona.USER,
DruidException.Category.INVALID_INPUT,
"Query could not be planned. A possible reason is "
+ "[SQL query requires ordering a table by non-time column [[dim1]], which is not supported.]"
Expand Down
Loading