sanjeet006py commented on code in PR #6868:
URL: https://github.com/apache/hbase/pull/6868#discussion_r2058087845


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractClientScanner.java:
##########
@@ -44,6 +64,24 @@ protected void initScanMetrics(Scan scan) {
    */
   @Override
   public ScanMetrics getScanMetrics() {
-    return scanMetrics;
+    if (scanMetricsByRegion != null) {
+      if (scanMetricsByRegion.isEmpty()) {
+        return null;
+      } else if (scanMetricsByRegion.size() == 1) {
+        return scanMetricsByRegion.get(0);
+      }
+      ScanMetrics overallScanMetrics = new ScanMetrics();
+      for (ScanMetrics otherScanMetrics : scanMetricsByRegion) {
+        overallScanMetrics.combineMetrics(otherScanMetrics);
+      }
+      return overallScanMetrics;
+    } else {
+      return scanMetrics;
+    }
+  }
+
+  @Override
+  public List<ScanMetrics> getScanMetricsByRegion() {

Review Comment:
   > it's because you haven't added the per-region scan metrics to the existing 
object. Why not?
   
   Actually I didn't consider that. But I like this idea of folding region 
level metrics into existing ScanMetrics object. Thanks



-- 
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]

Reply via email to