Repository: hbase
Updated Branches:
  refs/heads/branch-1 578e29f96 -> 7bd2795ee


HBASE-18555: Remove redundant familyMap.put() from addxxx() of sub-classes of 
Mutation and Query

Signed-off-by: Jerry He <jerry...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7bd2795e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7bd2795e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7bd2795e

Branch: refs/heads/branch-1
Commit: 7bd2795ee927df841a8c0ce3574598e9a6811739
Parents: 578e29f
Author: Xiang Li <wate...@gmail.com>
Authored: Fri Aug 11 00:07:11 2017 +0800
Committer: Jerry He <jerry...@apache.org>
Committed: Fri Aug 11 23:29:52 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/client/Append.java  |  2 +-
 .../main/java/org/apache/hadoop/hbase/client/Delete.java  | 10 +++++-----
 .../src/main/java/org/apache/hadoop/hbase/client/Get.java |  2 +-
 .../java/org/apache/hadoop/hbase/client/Increment.java    |  2 --
 .../java/org/apache/hadoop/hbase/client/Mutation.java     |  1 +
 .../src/main/java/org/apache/hadoop/hbase/client/Put.java |  7 -------
 .../main/java/org/apache/hadoop/hbase/client/Scan.java    |  2 +-
 7 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
----------------------------------------------------------------------
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 ec4ea37..0741a0d 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<Cell> list = this.familyMap.get(family);
     if (list == null) {
       list  = new ArrayList<Cell>();
+      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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
----------------------------------------------------------------------
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 4e1fe09..8682eae 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<Row> {
     List<Cell> list = familyMap.get(family);
     if (list == null) {
       list = new ArrayList<Cell>();
+      familyMap.put(family, list);
     }
     list.add(kv);
-    familyMap.put(family, list);
     return this;
   }
 
@@ -239,12 +239,12 @@ public class Delete extends Mutation implements 
Comparable<Row> {
     List<Cell> list = familyMap.get(family);
     if(list == null) {
       list = new ArrayList<Cell>();
+      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<Row> {
     List<Cell> list = familyMap.get(family);
     if(list == null) {
       list = new ArrayList<Cell>();
+      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<Row> {
     List<Cell> list = familyMap.get(family);
     if (list == null) {
       list = new ArrayList<Cell>();
+      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<Row> {
     List<Cell> list = familyMap.get(family);
     if(list == null) {
       list = new ArrayList<Cell>();
+      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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
----------------------------------------------------------------------
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 2a1e9f2..3286d57 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<byte []> set = familyMap.get(family);
     if(set == null) {
       set = new TreeSet<byte []>(Bytes.BYTES_COMPARATOR);
+      familyMap.put(family, set);
     }
     if (qualifier == null) {
       qualifier = HConstants.EMPTY_BYTE_ARRAY;
     }
     set.add(qualifier);
-    familyMap.put(family, set);
     return this;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
----------------------------------------------------------------------
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 22885d8..88c7bc1 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<Row> {
         " 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<Row> {
     List<Cell> list = getCellList(family);
     KeyValue kv = createPutKeyValue(family, qualifier, ts, 
Bytes.toBytes(amount));
     list.add(kv);
-    familyMap.put(CellUtil.cloneFamily(kv), list);
     return this;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/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 cc46137..2ba436b 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<Cell> list = this.familyMap.get(family);
     if (list == null) {
       list = new ArrayList<Cell>();
+      this.familyMap.put(family, list);
     }
     return list;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
----------------------------------------------------------------------
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 7e937de..60e9b88 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<Row> {
     List<Cell> 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<Row> {
     List<Cell> 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<Row> {
     List<Cell> 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<Row> {
     List<Cell> 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<Row> {
     List<Cell> 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<Row> {
     List<Cell> 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<Row> {
         " doesn't match the original one " +  Bytes.toStringBinary(this.row));
     }
     list.add(kv);
-    familyMap.put(family, list);
     return this;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7bd2795e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
----------------------------------------------------------------------
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 4efd405..1fbf23e 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<byte []> set = familyMap.get(family);
     if(set == null) {
       set = new TreeSet<byte []>(Bytes.BYTES_COMPARATOR);
+      familyMap.put(family, set);
     }
     if (qualifier == null) {
       qualifier = HConstants.EMPTY_BYTE_ARRAY;
     }
     set.add(qualifier);
-    familyMap.put(family, set);
     return this;
   }
 

Reply via email to