Search in sources :

Example 1 with EarlyEofException

use of org.apache.drill.exec.physical.impl.scan.v3.ManagedReader.EarlyEofException in project drill by apache.

the class TestScanLifecycleBasics method testEarlyEOF.

/**
 * Single reader, late schema, early EOF.
 * The scan never has a valid schema in this case.
 */
@Test
public void testEarlyEOF() {
    ScanLifecycleBuilder builder = new ScanLifecycleBuilder();
    builder.readerFactory(new SingleReaderFactory() {

        @Override
        public ManagedReader next(SchemaNegotiator negotiator) throws EarlyEofException {
            return new NoDataReader(negotiator);
        }
    });
    ScanLifecycle scan = buildScan(builder);
    RowBatchReader reader = scan.nextReader();
    assertFalse(reader.open());
    reader.close();
    assertFalse(scan.hasOutputSchema());
    scan.close();
}
Also used : RowBatchReader(org.apache.drill.exec.physical.impl.scan.RowBatchReader) EarlyEofException(org.apache.drill.exec.physical.impl.scan.v3.ManagedReader.EarlyEofException) ManagedReader(org.apache.drill.exec.physical.impl.scan.v3.ManagedReader) SchemaNegotiator(org.apache.drill.exec.physical.impl.scan.v3.SchemaNegotiator) ScanLifecycleBuilder(org.apache.drill.exec.physical.impl.scan.v3.ScanLifecycleBuilder) Test(org.junit.Test) EvfTest(org.apache.drill.categories.EvfTest)

Aggregations

EvfTest (org.apache.drill.categories.EvfTest)1 RowBatchReader (org.apache.drill.exec.physical.impl.scan.RowBatchReader)1 ManagedReader (org.apache.drill.exec.physical.impl.scan.v3.ManagedReader)1 EarlyEofException (org.apache.drill.exec.physical.impl.scan.v3.ManagedReader.EarlyEofException)1 ScanLifecycleBuilder (org.apache.drill.exec.physical.impl.scan.v3.ScanLifecycleBuilder)1 SchemaNegotiator (org.apache.drill.exec.physical.impl.scan.v3.SchemaNegotiator)1 Test (org.junit.Test)1