use of org.apache.beam.sdk.io.range.ByteKeyRange in project beam by apache.
the class HBaseIOTest method testReadingKeyRangePrefix.
/**
* Tests reading all rows using key ranges. Tests a prefix [), a suffix (], and a restricted range
* [] and that some properties hold across them.
*/
@Test
public void testReadingKeyRangePrefix() throws Exception {
final String table = tmpTable.getName();
final int numRows = 1001;
final ByteKey startKey = ByteKey.copyFrom("2".getBytes(StandardCharsets.UTF_8));
createAndWriteData(table, numRows);
// Test prefix: [beginning, startKey).
final ByteKeyRange prefixRange = ByteKeyRange.ALL_KEYS.withEndKey(startKey);
runReadTestLength(HBaseIO.read().withConfiguration(conf).withTableId(table).withKeyRange(prefixRange), false, 126);
}
use of org.apache.beam.sdk.io.range.ByteKeyRange in project beam by apache.
the class BigtableReadOptions method validate.
void validate() {
if (getRowFilter() != null && getRowFilter().isAccessible()) {
checkArgument(getRowFilter().get() != null, "rowFilter can not be null");
}
if (getKeyRanges() != null && getKeyRanges().isAccessible()) {
checkArgument(getKeyRanges().get() != null, "keyRanges can not be null");
checkArgument(!getKeyRanges().get().isEmpty(), "keyRanges can not be empty");
for (ByteKeyRange range : getKeyRanges().get()) {
checkArgument(range != null, "keyRanges cannot hold null range");
}
}
}
Aggregations