use of org.apache.hadoop.hbase.client.Scan.ReadType in project hbase by apache.
the class TestTableSnapshotInputFormat method testScannerReadTypeConfiguration.
@Test
public void testScannerReadTypeConfiguration() throws IOException {
Configuration conf = new Configuration(false);
// Explicitly set ReadTypes should persist
for (ReadType readType : Arrays.asList(ReadType.PREAD, ReadType.STREAM)) {
Scan scanWithReadType = new Scan();
scanWithReadType.setReadType(readType);
assertEquals(scanWithReadType.getReadType(), serializeAndReturn(conf, scanWithReadType).getReadType());
}
// We should only see the DEFAULT ReadType getting updated to STREAM.
Scan scanWithoutReadType = new Scan();
assertEquals(ReadType.DEFAULT, scanWithoutReadType.getReadType());
assertEquals(ReadType.STREAM, serializeAndReturn(conf, scanWithoutReadType).getReadType());
// We should still be able to force a certain ReadType when DEFAULT is given.
conf.setEnum(SNAPSHOT_INPUTFORMAT_SCANNER_READTYPE, ReadType.PREAD);
assertEquals(ReadType.DEFAULT, scanWithoutReadType.getReadType());
assertEquals(ReadType.PREAD, serializeAndReturn(conf, scanWithoutReadType).getReadType());
}
Aggregations