HBASE-18555: Remove redundant familyMap.put() from addxxx() of sub-classes of Mutation and Query
Signed-off-by: Jerry He <jerryjch@apache.org>
This commit is contained in:
parent
578e29f96b
commit
7bd2795ee9
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue