jadami10 commented on a change in pull request #7823:
URL: https://github.com/apache/pinot/pull/7823#discussion_r756409009



##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -456,10 +456,18 @@ private BrokerResponseNative handleSQLRequest(long 
requestId, String query, Json
     int numUnavailableSegments = unavailableSegments.size();
     requestStatistics.setNumUnavailableSegments(numUnavailableSegments);
 
+    List<QueryProcessingException> exceptions = new ArrayList<>();
+    if (numUnavailableSegments > 0) {
+      exceptions.add(new 
QueryProcessingException(QueryException.BROKER_SEGMENT_UNAVAILABLE_ERROR_CODE,
+          String.format("%d segments %s unavailable", numUnavailableSegments, 
unavailableSegments)));
+    }

Review comment:
       The only downside of this is under the hood, `getException` does
   ```
   String errorType = processingException.getMessage();
       ProcessingException copiedProcessingException = 
processingException.deepCopy();
       copiedProcessingException.setMessage(errorType + ":\n" + errorMessage);
       return copiedProcessingException;
   ```
   which is setting the error message to `"message": "null:\n1 segments 
[meetupRsvp_REALTIME_1637786040816_0__0__1637786041067] unavailable"`. The 
`null:\n` looks weird. I could make that code not do that on nulls, but I have 
no idea what else changes at that point.

##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -456,10 +456,18 @@ private BrokerResponseNative handleSQLRequest(long 
requestId, String query, Json
     int numUnavailableSegments = unavailableSegments.size();
     requestStatistics.setNumUnavailableSegments(numUnavailableSegments);
 
+    List<QueryProcessingException> exceptions = new ArrayList<>();
+    if (numUnavailableSegments > 0) {
+      exceptions.add(new 
QueryProcessingException(QueryException.BROKER_SEGMENT_UNAVAILABLE_ERROR_CODE,
+          String.format("%d segments %s unavailable", numUnavailableSegments, 
unavailableSegments)));
+    }
+
     if (offlineBrokerRequest == null && realtimeBrokerRequest == null) {
       LOGGER.info("No server found for request {}: {}", requestId, query);
       _brokerMetrics.addMeteredTableValue(rawTableName, 
BrokerMeter.NO_SERVER_FOUND_EXCEPTIONS, 1);
-      return BrokerResponseNative.EMPTY_RESULT;
+      BrokerResponseNative brokerResponse = BrokerResponseNative.EMPTY_RESULT;
+      brokerResponse.addToExceptions(exceptions);
+      return brokerResponse;

Review comment:
       oof, good catch.




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to