charlesconnell commented on code in PR #6978:
URL: https://github.com/apache/hbase/pull/6978#discussion_r2081837521


##########
hbase-endpoint/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java:
##########
@@ -111,11 +111,16 @@ public void getMax(RpcController controller, 
AggregateRequest request,
         postScanPartialResultUpdate(results, partialResultContext);
         results.clear();
       } while (hasMoreRows);
-      if (max != null) {
-        AggregateResponse.Builder builder = AggregateResponse.newBuilder();
-        builder.addFirstPart(ci.getProtoForCellType(max).toByteString());
-        setPartialResultResponse(builder, request, hasMoreRows, 
partialResultContext);
-        response = builder.build();
+      if (max != null && !request.getClientSupportsPartialResult()) {
+        ByteString first = ci.getProtoForCellType(max).toByteString();
+        response = AggregateResponse.newBuilder().addFirstPart(first).build();
+      } else if (request.getClientSupportsPartialResult()) {
+        AggregateResponse.Builder responseBuilder =
+          responseBuilder(request, hasMoreRows, partialResultContext);
+        if (max != null) {
+          
responseBuilder.addFirstPart(ci.getProtoForCellType(max).toByteString());
+        }
+        response = responseBuilder.build();

Review Comment:
   I'm making a call here about the API contract:
   - If no results were found, and partial results are not supported, return 
null. This maintains legacy behavior from before I get involved in the 
AggregationClient.
   - If no results were found, and partial results are supported, return a 
non-null object with the `firstPart` list empty. This is a new behavior, one 
that the client can already handle correctly.
   
   I mirror this approach in getMax, getMin, getSum, getStd, and getMedian. 
getRowNum works differently.



-- 
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: issues-unsubscr...@hbase.apache.org

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

Reply via email to