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 ec4ea37d9bd..0741a0dbdc6 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 @@ -125,10 +125,10 @@ public class Append extends Mutation { List list = this.familyMap.get(family); if (list == null) { list = new ArrayList(); + 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 4e1fe09ccb0..8682eaec9cc 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 @@ -173,9 +173,9 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if (list == null) { list = new ArrayList(); + familyMap.put(family, list); } list.add(kv); - familyMap.put(family, list); return this; } @@ -239,12 +239,12 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList(); + 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; } @@ -272,10 +272,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList(); + familyMap.put(family, list); } list.add(new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamilyVersion)); - familyMap.put(family, list); return this; } @@ -331,10 +331,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if (list == null) { list = new ArrayList(); + familyMap.put(family, list); } list.add(new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.DeleteColumn)); - familyMap.put(family, list); return this; } @@ -394,10 +394,10 @@ public class Delete extends Mutation implements Comparable { List list = familyMap.get(family); if(list == null) { list = new ArrayList(); + 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 2a1e9f23d1b..3286d57a0f0 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 @@ -176,12 +176,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 22885d8d95c..88c7bc1c274 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 @@ -106,7 +106,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; } @@ -130,7 +129,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 cc461373231..2ba436b07e1 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 @@ -116,6 +116,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 7e937de2f7a..60e9b8861c3 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 @@ -206,7 +206,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; } @@ -222,7 +221,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(family, list); return this; } @@ -237,7 +235,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; } @@ -256,7 +253,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; } @@ -292,7 +288,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; } @@ -308,7 +303,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; } @@ -331,7 +325,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 4efd405b72c..1fbf23e5791 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 @@ -341,12 +341,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; }