FrankChen021 commented on code in PR #20832:
URL: https://github.com/apache/druid/pull/20832#discussion_r4465619856


##########
server/src/main/java/org/apache/druid/server/QueryLifecycle.java:
##########
@@ -611,4 +613,17 @@ public static boolean shouldLogStackTrace(final Throwable 
e, final QueryContext
       return false;
     }
   }
+
+  /**
+   * Returns whether the exception is an error the user caused and can fix 
themselves, such as invalid SQL or an
+   * unknown table. The client already receives these in the response, and 
they are recorded in the request log and
+   * query metrics, so they don't need a WARN in the server log.
+   *
+   * @param e exception
+   */
+  public static boolean isUserError(final Throwable e)
+  {
+    return e instanceof DruidException
+           && ((DruidException) e).getTargetPersona() == 
DruidException.Persona.USER;

Review Comment:
   Good catch, fixed in c122b7236b. `isUserError` now also requires the 
category to be `INVALID_INPUT`, `NOT_FOUND` or `UNSUPPORTED`, so 
`USER`/`TIMEOUT` (and other categories like `CAPACITY_EXCEEDED`) stay at WARN. 
Added a regression test for `USER`/`TIMEOUT`.



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