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

Fix sql syntax error user #16583

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
* revert change to queryHandler and related tests, based on review co…
…mments
  • Loading branch information
zachjsh committed Jun 11, 2024
commit abe109262edf128e67f6373b96dc62ede370e3ea
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,16 @@ private DruidException buildSQLPlanningError(RelOptPlanner.CannotPlanException e
.ofCategory(DruidException.Category.UNSUPPORTED)
.build(exception, "Unhandled Query Planning Failure, see broker logs for details");
} else {
throw InvalidSqlInput.exception("Query could not be planned. A possible reason is [%s]", errorMessage);
// 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)
.ofCategory(DruidException.Category.INVALID_INPUT)
.build(
exception,
"Query could not be planned. A possible reason is [%s]",
errorMessage
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ public void assertQueryIsUnplannable(final PlannerConfig plannerConfig, final St

private DruidExceptionMatcher buildUnplannableExceptionMatcher()
{
return new DruidExceptionMatcher(Persona.USER, Category.INVALID_INPUT, "invalidInput");
if (testBuilder().isDecoupledMode()) {
return new DruidExceptionMatcher(Persona.USER, Category.INVALID_INPUT, "invalidInput");
} else {
return new DruidExceptionMatcher(Persona.ADMIN, Category.INVALID_INPUT, "general");
}
}

/**
Expand Down