From 81f507a29df35f1ccf27fc5590af152fd289913d Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sat, 26 Nov 2016 00:44:17 +0800 Subject: [PATCH] HBASE-17086: Add comments to explain why Cell#getTagsLength() returns an int, rather than a short --- hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java index 626f041..e9c3eea 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java @@ -170,6 +170,7 @@ public interface Cell { int getValueLength(); /** + * Contiguous raw bytes representing tags that may start at any index in the containing array. * @return the tags byte array */ byte[] getTagsArray(); @@ -180,6 +181,10 @@ public interface Cell { int getTagsOffset(); /** + * In {@link KeyValue} format, tagslength is of 2 bytes, but it is used to present a unsigned value. + * So the max length for tags is 65,535 (=2^16-1), which is defined as {@link TagUtil#MAX_TAGS_LENGTH}. + * As a result, an int is returned, as a short is not capable of handling that. + * * @return the total length of the tags in the Cell. */ int getTagsLength(); -- 2.9.3 (Apple Git-75)