kfaraz commented on a change in pull request #11566:
URL: https://github.com/apache/druid/pull/11566#discussion_r686917148
##########
File path:
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
##########
@@ -259,23 +244,22 @@ protected void service(HttpServletRequest request,
HttpServletResponse response)
request.setAttribute(QUERY_ATTRIBUTE, inputQuery);
}
catch (IOException e) {
- log.warn(e, "Exception parsing query");
- final String errorMessage = e.getMessage() == null ? "no error
message" : e.getMessage();
- requestLogger.logNativeQuery(
- RequestLogLine.forNative(
- null,
- DateTimes.nowUtc(),
- request.getRemoteAddr(),
- new QueryStats(ImmutableMap.of("success", false, "exception",
errorMessage))
- )
- );
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- response.setContentType(MediaType.APPLICATION_JSON);
- objectMapper.writeValue(
- response.getOutputStream(),
- ImmutableMap.of("error", errorMessage)
- );
-
+ handleQueryParseException(request, response, objectMapper, e, true);
+ return;
+ }
+ catch (Exception e) {
+ handleException(response, objectMapper, e);
+ return;
+ }
+ } else if (routeSqlQueries && isSqlQueryEndpoint &&
HttpMethod.DELETE.is(method)) {
+ targetServer = hostFinder.pickDefaultServer();
+ broadcastQueryCancelRequest(request, targetServer);
+ } else if (routeSqlQueries && isSqlQueryEndpoint &&
HttpMethod.POST.is(method)) {
+ try {
+ targetServer = getTargetServerForSql(request, objectMapper);
+ }
+ catch (IOException e) {
+ handleQueryParseException(request, response, objectMapper, e, false);
Review comment:
Removed the getTargetServer method as it is not really needed.
--
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]