Search in sources :

Example 6 with DummyFileWork

use of org.apache.drill.exec.physical.impl.scan.v3.file.BaseFileScanTest.DummyFileWork in project drill by apache.

the class TestFileScanLifecycle method testNoImplicit.

/**
 * Sanity test that the file scan framework works the same as the base framework
 * when no implicit columns are present.
 */
@Test
public void testNoImplicit() {
    FileScanLifecycleBuilder builder = new FileScanLifecycleBuilder();
    builder.rootDir(MOCK_ROOT_PATH);
    builder.fileSplits(Collections.singletonList(new DummyFileWork(MOCK_FILE_PATH)));
    builder.readerFactory(new FileReaderFactory() {

        @Override
        public ManagedReader newReader(FileSchemaNegotiator negotiator) {
            return new MockEarlySchemaReader(negotiator, 1);
        }
    });
    ScanLifecycle scan = buildScan(builder);
    assertSame(ProjectionType.ALL, scan.schemaTracker().projectionType());
    RowBatchReader reader = scan.nextReader();
    assertTrue(reader.open());
    assertTrue(reader.next());
    RowSetUtilities.verify(simpleExpected(0), fixture.wrap(reader.output()));
    assertFalse(reader.next());
    reader.close();
    scan.close();
}
Also used : RowBatchReader(org.apache.drill.exec.physical.impl.scan.RowBatchReader) DummyFileWork(org.apache.drill.exec.physical.impl.scan.v3.file.BaseFileScanTest.DummyFileWork) ManagedReader(org.apache.drill.exec.physical.impl.scan.v3.ManagedReader) ScanLifecycle(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.ScanLifecycle) BaseTestScanLifecycle(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.BaseTestScanLifecycle) Test(org.junit.Test) EvfTest(org.apache.drill.categories.EvfTest)

Aggregations

EvfTest (org.apache.drill.categories.EvfTest)6 RowBatchReader (org.apache.drill.exec.physical.impl.scan.RowBatchReader)6 ManagedReader (org.apache.drill.exec.physical.impl.scan.v3.ManagedReader)6 DummyFileWork (org.apache.drill.exec.physical.impl.scan.v3.file.BaseFileScanTest.DummyFileWork)6 BaseTestScanLifecycle (org.apache.drill.exec.physical.impl.scan.v3.lifecycle.BaseTestScanLifecycle)6 ScanLifecycle (org.apache.drill.exec.physical.impl.scan.v3.lifecycle.ScanLifecycle)6 Test (org.junit.Test)6 RowSet (org.apache.drill.exec.physical.rowSet.RowSet)4 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)4 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)4 UserException (org.apache.drill.common.exceptions.UserException)1 SchemaPath (org.apache.drill.common.expression.SchemaPath)1 Path (org.apache.hadoop.fs.Path)1