FrankChen021 commented on code in PR #20198:
URL: https://github.com/apache/druid/pull/20198#discussion_r3934066205
##########
sql/src/main/java/org/apache/druid/sql/SqlQueryPlus.java:
##########
@@ -272,6 +273,7 @@ public Builder auth(final AuthenticationResult authResult)
public SqlQueryPlus build()
{
final StatementAndSetContext statementAndSetContext =
DruidSqlParser.parse(sql, true);
+ QueryContextParameters.validate(statementAndSetContext.getSetContext());
Review Comment:
[P1] Preserve bad-request semantics for invalid SET values
`QueryContextParameters.validate` can throw an ordinary `IAE` (for example,
`SET maxRowsQueuedForOrdering = 0; SELECT ...`), and this call runs while
`SqlResource.doPost` is still creating the `HttpStatement`. That handler treats
every pre-statement exception that is not already a `DruidException` as an
operator `RUNTIME_FAILURE`, so the new validation path returns HTTP 500 for
malformed user input instead of the 400 invalid-SQL response used by the
parser. Convert validation failures to `InvalidSqlInput.exception(...)` (or
another `DruidException` with `INVALID_INPUT`) before they cross this HTTP
boundary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]