use of org.apache.drill.exec.physical.impl.scan.RowBatchReader in project drill by apache.
the class TestScanLifecycleSchema method testStrictProvidedSchemaSubset.
/**
* Lenient provided schema which is a subset of the reader's schema; the
* provided schema agrees with the reader types
*/
@Test
public void testStrictProvidedSchemaSubset() {
TupleMetadata schema = new SchemaBuilder().addAll(SCHEMA).build();
schema.setBooleanProperty(TupleMetadata.IS_STRICT_SCHEMA_PROP, true);
ScanLifecycleBuilder builder = new ScanLifecycleBuilder();
builder.providedSchema(schema);
builder.readerFactory(new SingleReaderFactory() {
@Override
public ManagedReader next(SchemaNegotiator negotiator) {
return new MockThreeColReader(negotiator);
}
});
ScanLifecycle scan = buildScan(builder);
RowBatchReader reader = scan.nextReader();
assertTrue(reader.open());
assertEquals(SCHEMA, scan.outputSchema());
assertTrue(reader.next());
RowSet expected = fixture.rowSetBuilder(SCHEMA).addRow(101, "wilma").addRow(102, "betty").build();
RowSetUtilities.verify(expected, fixture.wrap(reader.output()));
assertFalse(reader.next());
reader.close();
scan.close();
}
Aggregations