hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerry...@apache.org
Subject hbase git commit: HBASE-18555: Remove redundant familyMap.put() from addxxx() of sub-classes of Mutation and Query
Date Sat, 12 Aug 2017 05:53:12 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 95e883967 -> 173dce734


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

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


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

Branch: refs/heads/master
Commit: 173dce73471da005fb6780a7e7b65b43bad481e2
Parents: 95e8839
Author: Xiang Li <waterlx@gmail.com>
Authored: Fri Aug 11 00:07:11 2017 +0800
Committer: Jerry He <jerryjch@apache.org>
Committed: Fri Aug 11 22:49:38 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/173dce73/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 02ec770..2bd0860 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<Cell> 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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/173dce73/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 395c277..bf5241c 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<Row>
{
     List<Cell> 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<Row>
{
     List<Cell> 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<Row>
{
     List<Cell> 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<Row>
{
     List<Cell> 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<Row>
{
     List<Cell> 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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/173dce73/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 086a0b4..226ca85 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<byte []> 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;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/173dce73/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 d323555..c144c87 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<Row>
{
         " 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<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/173dce73/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 3b60497..25b088d 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<Cell> list = this.familyMap.get(family);
     if (list == null) {
       list = new ArrayList<>();
+      this.familyMap.put(family, list);
     }
     return list;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/173dce73/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 5c1528f..b5b10d0 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<Row>
{
     List<Cell> 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<Row>
{
 
     List<Cell> 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<Row>
{
     List<Cell> 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<Row>
{
     List<Cell> 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<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;
   }
 
@@ -309,7 +304,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;
   }
 
@@ -330,7 +324,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/173dce73/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 5b75151..9100b45 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<byte []> 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;
   }
 


Mime
View raw message