cryptoe commented on code in PR #14527:
URL: https://github.com/apache/druid/pull/14527#discussion_r1254637893
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -306,76 +315,127 @@ public Response doGetResults(
}
MSQControllerTask msqControllerTask =
getMSQControllerTaskOrThrow(queryId, authenticationResult.getIdentity());
- SqlStatementState sqlStatementState =
SqlStatementResourceHelper.getSqlStatementState(statusPlus);
+ throwIfQueryIsNotSuccessful(queryId, statusPlus);
- if (sqlStatementState == SqlStatementState.RUNNING || sqlStatementState
== SqlStatementState.ACCEPTED) {
- return buildNonOkResponse(
- DruidException.forPersona(DruidException.Persona.USER)
- .ofCategory(DruidException.Category.INVALID_INPUT)
- .build(
- "Query[%s] is currently in [%s] state. Please
wait for it to complete.",
- queryId,
- sqlStatementState
- )
- );
- } else if (sqlStatementState == SqlStatementState.FAILED) {
- return buildNonOkResponse(
- DruidException.forPersona(DruidException.Persona.USER)
- .ofCategory(DruidException.Category.INVALID_INPUT)
- .build(
- "Query[%s] failed. Hit status api for more
details.",
- queryId
- )
- );
- } else {
- Optional<List<ColumnNameAndTypes>> signature =
SqlStatementResourceHelper.getSignature(msqControllerTask);
- if (!signature.isPresent()) {
- return Response.ok().build();
- }
+ Optional<List<ColumnNameAndTypes>> signature =
SqlStatementResourceHelper.getSignature(msqControllerTask);
+ if (!signature.isPresent() ||
MSQControllerTask.isIngestion(msqControllerTask.getQuerySpec())) {
Review Comment:
This is more of a defensive check which does not harm us.
--
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]