Search in sources :

Example 1 with ReadType

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());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ReadType(org.apache.hadoop.hbase.client.Scan.ReadType) Scan(org.apache.hadoop.hbase.client.Scan) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 Scan (org.apache.hadoop.hbase.client.Scan)1 ReadType (org.apache.hadoop.hbase.client.Scan.ReadType)1 Test (org.junit.Test)1