cryptoe commented on code in PR #14534:
URL: https://github.com/apache/druid/pull/14534#discussion_r1259705988
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQTaskQueryMaker.java:
##########
@@ -228,16 +232,17 @@ public QueryResponse<Object[]> runQuery(final DruidQuery
druidQuery)
replaceTimeChunks
);
} else {
- if (ctxDestination != null &&
!DESTINATION_REPORT.equals(ctxDestination)) {
- throw new IAE("Cannot SELECT with destination [%s]", ctxDestination);
- }
final MSQSelectDestination msqSelectDestination =
MultiStageQueryContext.getSelectDestination(sqlQueryContext);
if (msqSelectDestination.equals(MSQSelectDestination.TASK_REPORT)) {
destination = TaskReportMSQDestination.instance();
} else if
(msqSelectDestination.equals(MSQSelectDestination.DURABLE_STORAGE)) {
destination = DurableStorageMSQDestination.instance();
} else {
- throw new IAE("Cannot SELECT with destination [%s]",
msqSelectDestination.name());
+ throw InvalidInput.exception(
+ "Unsupported select destination [%s] provided in the query
context. MSQ can currently write the select results to "
+ + "\"taskReport\" and \"durableStorage\"",
Review Comment:
You could use the enum names of `MSQSelectDestination` here
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -842,22 +826,9 @@ private static void throwIfQueryIsNotSuccessful(String
queryId, TaskStatusPlus s
private void contextChecks(QueryContext queryContext)
{
- ExecutionMode executionMode = queryContext.getEnum(
- QueryContexts.CTX_EXECUTION_MODE,
- ExecutionMode.class,
- null
- );
+ ExecutionMode executionMode =
queryContext.getEnum(QueryContexts.CTX_EXECUTION_MODE, ExecutionMode.class,
null);
if (ExecutionMode.ASYNC != executionMode) {
- throw DruidException.forPersona(DruidException.Persona.USER)
- .ofCategory(DruidException.Category.INVALID_INPUT)
- .build(
- StringUtils.format(
- "The statement sql api only supports sync
mode[%s]. Please set context parameter [%s=%s] in the context payload",
- ExecutionMode.ASYNC,
- QueryContexts.CTX_EXECUTION_MODE,
- ExecutionMode.ASYNC
- )
- );
+ throw DruidException.defensive("[%s] is not supported. It should not be
set", QueryContexts.CTX_EXECUTION_MODE);
Review Comment:
```suggestion
throw InvalidInput.exception(
"The statement sql api only supports
execution mode[%s]. Please set context parameter [%s=%s] in the context
payload",
ExecutionMode.ASYNC,
QueryContexts.CTX_EXECUTION_MODE,
ExecutionMode.ASYNC
);
```
This should be invalid input exception cause we need to tell the user to set
another execution mode.
--
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]