kfaraz commented on code in PR #14687:
URL: https://github.com/apache/druid/pull/14687#discussion_r1277572552


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -879,6 +881,16 @@ private <T> T contactOverlord(final ListenableFuture<T> 
future)
       return FutureUtils.getUnchecked(future, true);
     }
     catch (RuntimeException e) {
+      if (e.getCause() instanceof HttpResponseException) {
+        HttpResponseException httpResponseException = (HttpResponseException) 
e.getCause();
+        if (httpResponseException.getResponse() != null && 
httpResponseException.getResponse().getResponse().getStatus()
+                                                                               
 .equals(HttpResponseStatus.NOT_FOUND)) {
+          // since we get a 404, we mark the request as an invalid input. This 
code path is generally triggered when user passes a `queryId` which is not 
found on the overlord.
+          throw DruidException.forPersona(DruidException.Persona.DEVELOPER)

Review Comment:
   +1 on using `InvalidInput` and `USER` persona.



##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -879,6 +881,16 @@ private <T> T contactOverlord(final ListenableFuture<T> 
future)
       return FutureUtils.getUnchecked(future, true);
     }
     catch (RuntimeException e) {
+      if (e.getCause() instanceof HttpResponseException) {
+        HttpResponseException httpResponseException = (HttpResponseException) 
e.getCause();
+        if (httpResponseException.getResponse() != null && 
httpResponseException.getResponse().getResponse().getStatus()
+                                                                               
 .equals(HttpResponseStatus.NOT_FOUND)) {
+          // since we get a 404, we mark the request as an invalid input. This 
code path is generally triggered when user passes a `queryId` which is not 
found on the overlord.
+          throw DruidException.forPersona(DruidException.Persona.DEVELOPER)
+                              
.ofCategory(DruidException.Category.INVALID_INPUT)
+                              .build("Unable to contact overlord " + 
e.getMessage());

Review Comment:
   If it is an invalid input, why is the error message "unable to contact 
overlord"?



##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -879,6 +881,16 @@ private <T> T contactOverlord(final ListenableFuture<T> 
future)
       return FutureUtils.getUnchecked(future, true);
     }
     catch (RuntimeException e) {
+      if (e.getCause() instanceof HttpResponseException) {
+        HttpResponseException httpResponseException = (HttpResponseException) 
e.getCause();
+        if (httpResponseException.getResponse() != null && 
httpResponseException.getResponse().getResponse().getStatus()
+                                                                               
 .equals(HttpResponseStatus.NOT_FOUND)) {
+          // since we get a 404, we mark the request as an invalid input. This 
code path is generally triggered when user passes a `queryId` which is not 
found on the overlord.
+          throw DruidException.forPersona(DruidException.Persona.DEVELOPER)

Review Comment:
   I wonder if in the long term, it would be better to have the underlying 
`ServiceClient`/`OverlordClient` itself throw a `DruidException` at least for 
the non-retryable cases.



##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/sql/SqlStatementResourceTest.java:
##########
@@ -929,6 +936,33 @@ public void forbiddenTests()
     );
   }
 
+  @Test
+  public void taskIdNotFoundTests()

Review Comment:
   Nit: Doesn't seem like a standard test name.
   Typical test names start with `test` and/or mention the behaviour or method 
they verify.



-- 
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]

Reply via email to