charlesconnell commented on code in PR #6167:
URL: https://github.com/apache/hbase/pull/6167#discussion_r1742028164
##########
hbase-endpoint/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AsyncAggregationClient.java:
##########
@@ -131,32 +175,38 @@ private static byte[] nullToEmpty(byte[] b) {
CompletableFuture<R> future = new CompletableFuture<>();
AggregateRequest req;
try {
- req = validateArgAndGetPB(scan, ci, false);
+ req = validateArgAndGetPB(scan, ci, false, true);
} catch (IOException e) {
future.completeExceptionally(e);
return future;
}
- AbstractAggregationCallback<R> callback = new
AbstractAggregationCallback<R>(future) {
+ AbstractAggregationCallback<R> callback =
+ new AbstractAggregationCallback<>(future, req, AggregateService::getMax)
{
- private R max;
+ private R max;
+ private final Object lock = new Object();
Review Comment:
I'm playing with this idea. To do the accumulation of `max` I think you
would need something like:
```
private AtomicReference<CompletableFuture<R>> max;
@Override
protected void aggregate(RegionInfo region, AggregateResponse resp)
throws IOException {
if (resp.getFirstPartCount() > 0) {
R result = getCellValueFromProto(ci, resp, 0);
max.compareAndExchange(max, max.thenApply(m -> {
if (m == null || (result != null && ci.compare(m, result) <
0)) {
return result;
} else {
return m;
}
}));
}
}
```
except `AtomicReference::compareAndExchange` doesn't quite work the way I
would need. Even if I could figure this out, I'm not sure this would be an
improvement.
--
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]