From 62a78ab661ef432dfe054d0c15258057250fbc78 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Fri, 13 Jun 2014 02:10:15 +0000 Subject: [PATCH] HBASE-11107 Provide utility method equivalent to 0.92's Result.getBytes().getSize() (Gustavo Anatoly) --- .../java/org/apache/hadoop/hbase/client/Result.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java index 0002b1c4500..b3f7076add0 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java @@ -788,6 +788,19 @@ public class Result implements CellScannable { } } + /** + * Get total size of raw cells + * @param result + * @return Total size. + */ + public static long getTotalSizeOfCells(Result result) { + long size = 0; + for (Cell c : result.rawCells()) { + size += KeyValueUtil.ensureKeyValue(c).heapSize(); + } + return size; + } + /** * Copy another Result into this one. Needed for the old Mapred framework * @param other