diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java index 02ec770de0e..2bd08608f30 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java @@ -137,10 +137,10 @@ public class Append extends Mutation { List list = this.familyMap.get(family); if (list == null) { list = new ArrayList<>(1); + this.familyMap.put(family, list); } // find where the new entry should be placed in the List list.add(cell); - this.familyMap.put(family, list); return this; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java index 395c277e9de..bf5241c5d99 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java @@ -183,9 +183,9 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if (list == null) { list = new ArrayList<>(1); + familyMap.put(family, list); } list.add(kv); - familyMap.put(family, list); return this; } @@ -219,12 +219,12 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList<>(1); + familyMap.put(family, list); } else if(!list.isEmpty()) { list.clear(); } KeyValue kv = new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamily); list.add(kv); - familyMap.put(family, list); return this; } @@ -239,10 +239,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList<>(1); + familyMap.put(family, list); } list.add(new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamilyVersion)); - familyMap.put(family, list); return this; } @@ -272,10 +272,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if (list == null) { list = new ArrayList<>(1); + familyMap.put(family, list); } list.add(new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.DeleteColumn)); - familyMap.put(family, list); return this; } @@ -307,10 +307,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList<>(1); + familyMap.put(family, list); } KeyValue kv = new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.Delete); list.add(kv); - familyMap.put(family, list); return this; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java index 086a0b449f6..226ca859749 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java @@ -205,12 +205,12 @@ public class Get extends Query NavigableSet set = familyMap.get(family); if(set == null) { set = new TreeSet<>(Bytes.BYTES_COMPARATOR); + familyMap.put(family, set); } if (qualifier == null) { qualifier = HConstants.EMPTY_BYTE_ARRAY; } set.add(qualifier); - familyMap.put(family, set); return this; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java index d32355513f8..c144c87edff 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java @@ -102,7 +102,6 @@ public class Increment extends Mutation implements Comparable { " doesn't match the original one " + Bytes.toStringBinary(this.row)); } list.add(cell); - familyMap.put(family, list); return this; } @@ -123,7 +122,6 @@ public class Increment extends Mutation implements Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, Bytes.toBytes(amount)); list.add(kv); - familyMap.put(CellUtil.cloneFamily(kv), list); return this; } 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 3b6049729a0..25b088df19f 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 @@ -111,6 +111,7 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C List list = this.familyMap.get(family); if (list == null) { list = new ArrayList<>(); + this.familyMap.put(family, list); } return list; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java index 5c1528f218f..b5b10d0879a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java @@ -216,7 +216,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value); list.add(kv); - familyMap.put(CellUtil.cloneFamily(kv), list); return this; } @@ -238,7 +237,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); list.add(new IndividualBytesFieldCell(this.row, family, qualifier, ts, KeyValue.Type.Put, value)); - familyMap.put(family, list); return this; } @@ -253,7 +251,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag); list.add(kv); - familyMap.put(family, list); return this; } @@ -272,7 +269,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag); list.add(kv); - familyMap.put(family, list); return this; } @@ -293,7 +289,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null); list.add(kv); - familyMap.put(CellUtil.cloneFamily(kv), list); return this; } @@ -309,7 +304,6 @@ public class Put extends Mutation implements HeapSize, Comparable { List list = getCellList(family); KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null); list.add(kv); - familyMap.put(family, list); return this; } @@ -330,7 +324,6 @@ public class Put extends Mutation implements HeapSize, Comparable { " doesn't match the original one " + Bytes.toStringBinary(this.row)); } list.add(kv); - familyMap.put(family, list); return this; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index 5b75151bbda..9100b45c394 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -340,12 +340,12 @@ public class Scan extends Query { NavigableSet set = familyMap.get(family); if(set == null) { set = new TreeSet<>(Bytes.BYTES_COMPARATOR); + familyMap.put(family, set); } if (qualifier == null) { qualifier = HConstants.EMPTY_BYTE_ARRAY; } set.add(qualifier); - familyMap.put(family, set); return this; }