HBASE-11310:Delete's copy constructor should copy the attributes also

(Ram)
This commit is contained in:
Ramkrishna 2014-06-11 22:58:02 +05:30
parent eb1db5ac71
commit af9fa42e1b
4 changed files with 49 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
@ -70,6 +71,18 @@ public class Append extends Mutation {
public Append(byte[] row) {
this(row, 0, row.length);
}
/**
* Copy constructor
* @param a
*/
public Append(Append a) {
this.row = a.getRow();
this.ts = a.getTimeStamp();
this.familyMap.putAll(a.getFamilyCellMap());
for (Map.Entry<String, byte[]> entry : a.getAttributesMap().entrySet()) {
this.setAttribute(entry.getKey(), entry.getValue());
}
}
/** Create a Append operation for the specified row.
* <p>

View File

@ -140,6 +140,9 @@ public class Delete extends Mutation implements Comparable<Row> {
this.ts = d.getTimeStamp();
this.familyMap.putAll(d.getFamilyCellMap());
this.durability = d.durability;
for (Map.Entry<String, byte[]> entry : d.getAttributesMap().entrySet()) {
this.setAttribute(entry.getKey(), entry.getValue());
}
}
/**

View File

@ -90,6 +90,26 @@ public class Get extends Query
this.row = row;
}
/**
* Copy-constructor
*
* @param get
*/
public Get(Get get) {
this.filter = get.getFilter();
this.cacheBlocks = get.getCacheBlocks();
this.maxVersions = get.getMaxVersions();
this.storeLimit = get.getMaxResultsPerColumnFamily();
this.storeOffset = get.getRowOffsetPerColumnFamily();
this.tr = get.getTimeRange();
this.checkExistenceOnly = get.isCheckExistenceOnly();
this.closestRowBefore = get.isClosestRowBefore();
this.familyMap = get.getFamilyMap();
for (Map.Entry<String, byte[]> attr : get.getAttributesMap().entrySet()) {
setAttribute(attr.getKey(), attr.getValue());
}
}
public boolean isCheckExistenceOnly() {
return checkExistenceOnly;
}

View File

@ -72,6 +72,19 @@ public class Increment extends Mutation implements Comparable<Row> {
checkRow(row, offset, length);
this.row = Bytes.copy(row, offset, length);
}
/**
* Copy constructor
* @param i
*/
public Increment(Increment i) {
this.row = i.getRow();
this.ts = i.getTimeStamp();
this.tr = i.getTimeRange();
this.familyMap.putAll(i.getFamilyCellMap());
for (Map.Entry<String, byte[]> entry : i.getAttributesMap().entrySet()) {
this.setAttribute(entry.getKey(), entry.getValue());
}
}
/**
* Add the specified KeyValue to this operation.