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
b5d4a0aa41
commit
8cebf7f1a8
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue