Repository: hbase Updated Branches: refs/heads/branch-2.0 691fea2b0 -> 5146b29c5
HBASE-20710 extra cloneFamily() in Mutation.add(Cell) Signed-off-by: Michael Stack <st...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5146b29c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5146b29c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5146b29c Branch: refs/heads/branch-2.0 Commit: 5146b29c5509c2b72d708e7445da64fd977a8c91 Parents: 691fea2 Author: Huaxiang Sun <h...@cloudera.com> Authored: Sat Jun 23 18:45:23 2018 -0700 Committer: Michael Stack <st...@apache.org> Committed: Sat Jun 23 20:38:24 2018 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/client/Mutation.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/5146b29c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java index a6ddc14..3d93501 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java @@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.ExtendedCell; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.IndividualBytesFieldCell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.RawCell; @@ -115,10 +116,9 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C this.row = clone.getRow(); this.ts = clone.getTimestamp(); this.familyMap = clone.getFamilyCellMap().entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey(), e -> new ArrayList<>(e.getValue()), - (k, v) -> { - throw new RuntimeException("collisions!!!"); - }, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR))); + .collect(Collectors.toMap(e -> e.getKey(), e -> new ArrayList<>(e.getValue()), (k, v) -> { + throw new RuntimeException("collisions!!!"); + }, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR))); } /** @@ -788,11 +788,18 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C " doesn't match the original one " + Bytes.toStringBinary(this.row)); } - if (cell.getFamilyArray() == null || cell.getFamilyLength() == 0) { + byte[] family; + + if (cell instanceof IndividualBytesFieldCell) { + family = cell.getFamilyArray(); + } else { + family = CellUtil.cloneFamily(cell); + } + + if (family == null || family.length == 0) { throw new IllegalArgumentException("Family cannot be null"); } - byte[] family = CellUtil.cloneFamily(cell); if (cell instanceof ExtendedCell) { getCellList(family).add(cell); } else {