HBASE-18573 Update Append and Delete to use Mutation#getCellList(family)
Signed-off-by: Jerry He <jerryjch@apache.org>
This commit is contained in:
parent
1f1ab8c873
commit
54aaf6bfb7
@ -122,11 +122,10 @@ public class Append extends Mutation {
|
|||||||
public Append add(final Cell cell) {
|
public Append add(final Cell cell) {
|
||||||
// Presume it is KeyValue for now.
|
// Presume it is KeyValue for now.
|
||||||
byte [] family = CellUtil.cloneFamily(cell);
|
byte [] family = CellUtil.cloneFamily(cell);
|
||||||
List<Cell> list = this.familyMap.get(family);
|
|
||||||
if (list == null) {
|
// Get cell list for the family
|
||||||
list = new ArrayList<Cell>();
|
List<Cell> list = getCellList(family);
|
||||||
this.familyMap.put(family, list);
|
|
||||||
}
|
|
||||||
// find where the new entry should be placed in the List
|
// find where the new entry should be placed in the List
|
||||||
list.add(cell);
|
list.add(cell);
|
||||||
return this;
|
return this;
|
||||||
|
@ -170,11 +170,7 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||||||
" doesn't match the original one " + Bytes.toStringBinary(this.row));
|
" doesn't match the original one " + Bytes.toStringBinary(this.row));
|
||||||
}
|
}
|
||||||
byte [] family = CellUtil.cloneFamily(kv);
|
byte [] family = CellUtil.cloneFamily(kv);
|
||||||
List<Cell> list = familyMap.get(family);
|
List<Cell> list = getCellList(family);
|
||||||
if (list == null) {
|
|
||||||
list = new ArrayList<Cell>();
|
|
||||||
familyMap.put(family, list);
|
|
||||||
}
|
|
||||||
list.add(kv);
|
list.add(kv);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -236,11 +232,8 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||||||
if (timestamp < 0) {
|
if (timestamp < 0) {
|
||||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||||
}
|
}
|
||||||
List<Cell> list = familyMap.get(family);
|
List<Cell> list = getCellList(family);
|
||||||
if(list == null) {
|
if(!list.isEmpty()) {
|
||||||
list = new ArrayList<Cell>();
|
|
||||||
familyMap.put(family, list);
|
|
||||||
} else if(!list.isEmpty()) {
|
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
KeyValue kv = new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamily);
|
KeyValue kv = new KeyValue(row, family, null, timestamp, KeyValue.Type.DeleteFamily);
|
||||||
@ -269,11 +262,7 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||||||
* @return this for invocation chaining
|
* @return this for invocation chaining
|
||||||
*/
|
*/
|
||||||
public Delete addFamilyVersion(final byte [] family, final long timestamp) {
|
public Delete addFamilyVersion(final byte [] family, final long timestamp) {
|
||||||
List<Cell> list = familyMap.get(family);
|
List<Cell> list = getCellList(family);
|
||||||
if(list == null) {
|
|
||||||
list = new ArrayList<Cell>();
|
|
||||||
familyMap.put(family, list);
|
|
||||||
}
|
|
||||||
list.add(new KeyValue(row, family, null, timestamp,
|
list.add(new KeyValue(row, family, null, timestamp,
|
||||||
KeyValue.Type.DeleteFamilyVersion));
|
KeyValue.Type.DeleteFamilyVersion));
|
||||||
return this;
|
return this;
|
||||||
@ -328,11 +317,7 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||||||
if (timestamp < 0) {
|
if (timestamp < 0) {
|
||||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||||
}
|
}
|
||||||
List<Cell> list = familyMap.get(family);
|
List<Cell> list = getCellList(family);
|
||||||
if (list == null) {
|
|
||||||
list = new ArrayList<Cell>();
|
|
||||||
familyMap.put(family, list);
|
|
||||||
}
|
|
||||||
list.add(new KeyValue(this.row, family, qualifier, timestamp,
|
list.add(new KeyValue(this.row, family, qualifier, timestamp,
|
||||||
KeyValue.Type.DeleteColumn));
|
KeyValue.Type.DeleteColumn));
|
||||||
return this;
|
return this;
|
||||||
@ -391,11 +376,7 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||||||
if (timestamp < 0) {
|
if (timestamp < 0) {
|
||||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
|
||||||
}
|
}
|
||||||
List<Cell> list = familyMap.get(family);
|
List<Cell> list = getCellList(family);
|
||||||
if(list == null) {
|
|
||||||
list = new ArrayList<Cell>();
|
|
||||||
familyMap.put(family, list);
|
|
||||||
}
|
|
||||||
KeyValue kv = new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.Delete);
|
KeyValue kv = new KeyValue(this.row, family, qualifier, timestamp, KeyValue.Type.Delete);
|
||||||
list.add(kv);
|
list.add(kv);
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user