本文整理了Java中org.apache.hadoop.hbase.client.Append.setTimeRange()
方法的一些代码示例,展示了Append.setTimeRange()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.setTimeRange()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:setTimeRange
[英]Sets the TimeRange to be used on the Get for this append.
This is useful for when you have counters that only last for specific periods of time (ie. counters that are partitioned by time). By setting the range of valid times for this append, you can potentially gain some performance with a more optimal Get operation. Be careful adding the time range to this class as you will update the old cell if the time range doesn't include the latest cells.
This range is used as [minStamp, maxStamp).
[中]设置此附加的Get上要使用的时间范围。
当您的计数器只持续特定时间段(即按时间分区的计数器)时,这非常有用。通过设置此附加的有效时间范围,您可以通过更优化的Get操作获得一些性能。请小心将时间范围添加到此类中,因为如果时间范围不包括最新的单元格,您将更新旧单元格。
此范围用作[minStamp,maxStamp]。
代码示例来源:origin: apache/hbase
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: apache/hbase
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = protoToTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: apache/hbase
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = toTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: apache/hbase
TimeRange range10 = new TimeRange(1, time + 10);
Result r = table.append(new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("b"))
.setTimeRange(range10.getMin(), range10.getMax()));
checkRowValue(table, ROW, Bytes.toBytes("ab"));
assertEquals(MyObserver.tr10.getMin(), range10.getMin());
Arrays.asList(new Row[] {
new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("c"))
.setTimeRange(range2.getMin(), range2.getMax()),
new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("c"))
.setTimeRange(range2.getMin(), range2.getMax()) });
Object[] results1 = new Object[actions.size()];
table.batch(actions, results1);
代码示例来源:origin: org.apache.hbase/hbase-client
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = protoToTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = toTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = toTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
Append append = toDelta((Bytes row) -> new Append(row.get(), row.getOffset(), row.getLength()),
Append::add, proto, cellScanner);
if (proto.hasTimeRange()) {
TimeRange timeRange = protoToTimeRange(proto.getTimeRange());
append.setTimeRange(timeRange.getMin(), timeRange.getMax());
}
return append;
}
代码示例来源:origin: org.apache.hbase/hbase-server
TimeRange range10 = new TimeRange(1, time + 10);
Result r = table.append(new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("b"))
.setTimeRange(range10.getMin(), range10.getMax()));
checkRowValue(table, ROW, Bytes.toBytes("ab"));
assertEquals(MyObserver.tr10.getMin(), range10.getMin());
Arrays.asList(new Row[] {
new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("c"))
.setTimeRange(range2.getMin(), range2.getMax()),
new Append(ROW).addColumn(TEST_FAMILY, QUAL, Bytes.toBytes("c"))
.setTimeRange(range2.getMin(), range2.getMax()) });
Object[] results1 = new Object[actions.size()];
table.batch(actions, results1);
内容来源于网络,如有侵权,请联系作者删除!