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 c19a6a9..ff4ac0a 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 @@ -208,6 +208,11 @@ public class Get extends Query return this; } + public Get setTimeRange(TimeRange tr) { + this.tr = tr; + return this; + } + /** * Get versions of columns with the specified timestamp. * @param timestamp version timestamp @@ -229,6 +234,10 @@ public class Get extends Query return (Get) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp); } + @Override public Get setColumnFamilyTimeRange(byte[] cf, TimeRange tr) { + return (Get) super.setColumnFamilyTimeRange(cf, tr); + } + /** * Get all available versions. * @return this for invocation chaining diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java index a287499..e79e81f 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java @@ -227,12 +227,16 @@ public abstract class Query extends OperationWithAttributes { * @param maxStamp maximum timestamp value, exclusive * @return this */ - public Query setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) { colFamTimeRangeMap.put(cf, new TimeRange(minStamp, maxStamp)); return this; } + public Query setColumnFamilyTimeRange(byte[] cf, TimeRange tr) { + colFamTimeRangeMap.put(cf, tr); + return this; + } + /** * @return A map of column families to time ranges */ diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index 9d659b8..05b0700 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -340,6 +340,11 @@ public class Scan extends Query { return this; } + public Scan setTimeRange(TimeRange tr) { + this.tr = tr; + return this; + } + /** * Get versions of columns with the specified timestamp. Note, default maximum * versions to return is 1. If your time range spans more than one version @@ -366,6 +371,10 @@ public class Scan extends Query { return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp); } + @Override public Scan setColumnFamilyTimeRange(byte[] cf, TimeRange tr) { + return (Scan) super.setColumnFamilyTimeRange(cf, tr); + } + /** * Set the start row of the scan. *

diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index c52d413..d6dc7e9 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -385,13 +385,12 @@ public final class ProtobufUtil { if (proto.getCfTimeRangeCount() > 0) { for (HBaseProtos.ColumnFamilyTimeRange cftr : proto.getCfTimeRangeList()) { TimeRange timeRange = protoToTimeRange(cftr.getTimeRange()); - get.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), - timeRange.getMin(), timeRange.getMax()); + get.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), timeRange); } } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - get.setTimeRange(timeRange.getMin(), timeRange.getMax()); + get.setTimeRange(timeRange); } if (proto.hasFilter()) { FilterProtos.Filter filter = proto.getFilter(); @@ -807,7 +806,7 @@ public final class ProtobufUtil { } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - get.setTimeRange(timeRange.getMin(), timeRange.getMax()); + get.setTimeRange(timeRange); } for (NameBytesPair attribute : proto.getAttributeList()) { get.setAttribute(attribute.getName(), attribute.getValue().toByteArray()); @@ -951,13 +950,12 @@ public final class ProtobufUtil { if (proto.getCfTimeRangeCount() > 0) { for (HBaseProtos.ColumnFamilyTimeRange cftr : proto.getCfTimeRangeList()) { TimeRange timeRange = protoToTimeRange(cftr.getTimeRange()); - scan.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), - timeRange.getMin(), timeRange.getMax()); + scan.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), timeRange); } } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - scan.setTimeRange(timeRange.getMin(), timeRange.getMax()); + scan.setTimeRange(timeRange); } if (proto.hasFilter()) { FilterProtos.Filter filter = proto.getFilter(); diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index 4e75694..0f2cf1d 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -497,13 +497,12 @@ public final class ProtobufUtil { if (proto.getCfTimeRangeCount() > 0) { for (HBaseProtos.ColumnFamilyTimeRange cftr : proto.getCfTimeRangeList()) { TimeRange timeRange = protoToTimeRange(cftr.getTimeRange()); - get.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), - timeRange.getMin(), timeRange.getMax()); + get.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), timeRange); } } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - get.setTimeRange(timeRange.getMin(), timeRange.getMax()); + get.setTimeRange(timeRange); } if (proto.hasFilter()) { FilterProtos.Filter filter = proto.getFilter(); @@ -920,7 +919,7 @@ public final class ProtobufUtil { } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - get.setTimeRange(timeRange.getMin(), timeRange.getMax()); + get.setTimeRange(timeRange); } for (NameBytesPair attribute : proto.getAttributeList()) { get.setAttribute(attribute.getName(), attribute.getValue().toByteArray()); @@ -1064,13 +1063,12 @@ public final class ProtobufUtil { if (proto.getCfTimeRangeCount() > 0) { for (HBaseProtos.ColumnFamilyTimeRange cftr : proto.getCfTimeRangeList()) { TimeRange timeRange = protoToTimeRange(cftr.getTimeRange()); - scan.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), - timeRange.getMin(), timeRange.getMax()); + scan.setColumnFamilyTimeRange(cftr.getColumnFamily().toByteArray(), timeRange); } } if (proto.hasTimeRange()) { TimeRange timeRange = protoToTimeRange(proto.getTimeRange()); - scan.setTimeRange(timeRange.getMin(), timeRange.getMax()); + scan.setTimeRange(timeRange); } if (proto.hasFilter()) { FilterProtos.Filter filter = proto.getFilter();