walterddr commented on code in PR #12338:
URL: https://github.com/apache/pinot/pull/12338#discussion_r1480163071
##########
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java:
##########
@@ -348,4 +349,25 @@ private static HttpRequesterIdentity
makeHttpIdentity(org.glassfish.grizzly.http
return identity;
}
+
+ /**
+ * Generate Response object from the BrokerResponse object with
'X-Pinot-Error-Code' header value
+ * @param brokerResponse
+ * @return Response
+ * @throws Exception
+ */
+ private static Response getPinotQueryResponse(BrokerResponse brokerResponse)
+ throws Exception {
+ int headerValue = -1; // default value of the header.
+
+ if (brokerResponse.getExceptionsSize() != 0) {
+ // set the header value as first exception error code value.
+ headerValue =
brokerResponse.getProcessingExceptions().get(0).getErrorCode();
+ }
+
+ // returning the Response with OK status and header value.
+ return Response.ok()
+ .header(PINOT_QUERY_ERROR_CODE_HEADER, headerValue)
Review Comment:
was referring to the handling of these numbers:
https://github.com/apache/pinot/blob/9314c116adf0330a3c4b38d722f53a857a618add/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java#L49
for example at the bottom there's client error. was wondering if we want to
differentiate with query error code header between client/broker/server error
##########
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java:
##########
@@ -348,4 +349,25 @@ private static HttpRequesterIdentity
makeHttpIdentity(org.glassfish.grizzly.http
return identity;
}
+
+ /**
+ * Generate Response object from the BrokerResponse object with
'X-Pinot-Error-Code' header value
+ * @param brokerResponse
+ * @return Response
+ * @throws Exception
+ */
+ private static Response getPinotQueryResponse(BrokerResponse brokerResponse)
+ throws Exception {
+ int headerValue = -1; // default value of the header.
+
+ if (brokerResponse.getExceptionsSize() != 0) {
+ // set the header value as first exception error code value.
+ headerValue =
brokerResponse.getProcessingExceptions().get(0).getErrorCode();
+ }
+
+ // returning the Response with OK status and header value.
+ return Response.ok()
+ .header(PINOT_QUERY_ERROR_CODE_HEADER, headerValue)
Review Comment:
was referring to the handling of these numbers:
https://github.com/apache/pinot/blob/9314c116adf0330a3c4b38d722f53a857a618add/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java#L49
for example at the bottom there's client error. was wondering if we want to
differentiate with query error code header key between client/broker/server
error
--
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]