diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java index ae642ba..05bca9f 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java @@ -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 entry : a.getAttributesMap().entrySet()) { + this.setAttribute(entry.getKey(), entry.getValue()); + } + } /** Create a Append operation for the specified row. *

diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java index 24ce293..0b6d618 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java @@ -140,6 +140,9 @@ public class Delete extends Mutation implements Comparable { this.ts = d.getTimeStamp(); this.familyMap.putAll(d.getFamilyCellMap()); this.durability = d.durability; + for (Map.Entry entry : d.getAttributesMap().entrySet()) { + this.setAttribute(entry.getKey(), entry.getValue()); + } } /** diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java index 588b94e..81a31a4 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java @@ -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 attr : get.getAttributesMap().entrySet()) { + setAttribute(attr.getKey(), attr.getValue()); + } + } + public boolean isCheckExistenceOnly() { return checkExistenceOnly; } diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java index ce50c28..0af4695 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java @@ -72,6 +72,19 @@ public class Increment extends Mutation implements Comparable { 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 entry : i.getAttributesMap().entrySet()) { + this.setAttribute(entry.getKey(), entry.getValue()); + } + } /** * Add the specified KeyValue to this operation.