gortiz commented on code in PR #13179:
URL: https://github.com/apache/pinot/pull/13179#discussion_r1616704601
##########
pinot-common/src/main/java/org/apache/pinot/common/response/BrokerResponse.java:
##########
@@ -32,264 +34,241 @@
public interface BrokerResponse {
/**
- * Set exceptions caught during request handling, into the broker response.
+ * Convert the broker response to JSON String.
*/
- void setExceptions(List<ProcessingException> exceptions);
-
- void addToExceptions(QueryProcessingException processingException);
+ default String toJsonString()
+ throws IOException {
+ return JsonUtils.objectToString(this);
+ }
/**
- * Set the number of servers got queried by the broker.
- *
- * @param numServersQueried number of servers got queried.
+ * Returns the result table.
*/
- void setNumServersQueried(int numServersQueried);
+ @Nullable
+ ResultTable getResultTable();
/**
- * Set the number of servers responded to the broker.
- *
- * @param numServersResponded number of servers responded.
+ * Sets the result table. We expose this method to allow modifying the
results on the client side, e.g. hiding the
+ * results and only showing the stats.
*/
- void setNumServersResponded(int numServersResponded);
+ void setResultTable(@Nullable ResultTable resultTable);
Review Comment:
This seems to be the only mutable method in this interface. Wouldn't be
better to implement the case shown in the example using a delegate/decorate
pattern? Basically having an implementation that delegates all methods but
`getResultTable` and `getNumRowsResultSet` to a another `BrokerResponse` stored
as attribute
--
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]