Search in sources :

Example 1 with StaticBatchBuilder

use of org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder in project drill by apache.

the class TestImplicitColumnLoader method testOneColumn.

@Test
public void testOneColumn() {
    StaticBatchBuilder batchLoader = buildHandler(RowSetTestUtils.projectList("a", ScanTestUtils.FILE_NAME_COL, "b"), MOCK_ROOT_PATH, MOCK_FILE_PATH);
    assertNotNull(batchLoader);
    batchLoader.load(2);
    TupleMetadata expectedSchema = new SchemaBuilder().add(ScanTestUtils.FILE_NAME_COL, IMPLICIT_COL_TYPE).build();
    RowSet expected = fixture.rowSetBuilder(expectedSchema).addRow(MOCK_FILE_NAME).addRow(MOCK_FILE_NAME).build();
    RowSetUtilities.verify(expected, fixture.wrap(batchLoader.outputContainer()));
}
Also used : TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder) RowSet(org.apache.drill.exec.physical.rowSet.RowSet) StaticBatchBuilder(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder) SubOperatorTest(org.apache.drill.test.SubOperatorTest) EvfTest(org.apache.drill.categories.EvfTest) Test(org.junit.Test)

Example 2 with StaticBatchBuilder

use of org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder in project drill by apache.

the class TestImplicitColumnLoader method testInternalEmptyFile.

@Test
public void testInternalEmptyFile() {
    ImplicitFixture testFixture = new ImplicitFixture(RowSetTestUtils.projectList(ScanTestUtils.LAST_MODIFIED_TIME_COL, ScanTestUtils.PROJECT_METADATA_COL), MOCK_ROOT_PATH);
    testFixture.build(MOCK_FILE_PATH);
    testFixture.fileDescrip.setModTime("123456789");
    testFixture.fileDescrip.markEmpty();
    StaticBatchBuilder batchLoader = testFixture.batchBuilder();
    assertNotNull(batchLoader);
    batchLoader.load(1);
    TupleMetadata expectedSchema = new SchemaBuilder().add(ScanTestUtils.LAST_MODIFIED_TIME_COL, MinorType.VARCHAR).addNullable(ScanTestUtils.PROJECT_METADATA_COL, MinorType.VARCHAR).build();
    RowSet expected = fixture.rowSetBuilder(expectedSchema).addRow("123456789", "false").build();
    RowSetUtilities.verify(expected, fixture.wrap(batchLoader.outputContainer()));
}
Also used : TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder) RowSet(org.apache.drill.exec.physical.rowSet.RowSet) StaticBatchBuilder(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder) SubOperatorTest(org.apache.drill.test.SubOperatorTest) EvfTest(org.apache.drill.categories.EvfTest) Test(org.junit.Test)

Example 3 with StaticBatchBuilder

use of org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder in project drill by apache.

the class TestImplicitColumnLoader method testInternalColumns.

@Test
public void testInternalColumns() {
    ImplicitFixture testFixture = new ImplicitFixture(RowSetTestUtils.projectList(ScanTestUtils.LAST_MODIFIED_TIME_COL, ScanTestUtils.PROJECT_METADATA_COL, ScanTestUtils.ROW_GROUP_INDEX_COL, ScanTestUtils.ROW_GROUP_START_COL, ScanTestUtils.ROW_GROUP_LENGTH_COL), MOCK_ROOT_PATH);
    testFixture.build(MOCK_FILE_PATH);
    testFixture.fileDescrip.setRowGroupAttribs(10, 10_000, 5_000);
    testFixture.fileDescrip.setModTime("123456789");
    StaticBatchBuilder batchLoader = testFixture.batchBuilder();
    assertNotNull(batchLoader);
    batchLoader.load(2);
    TupleMetadata expectedSchema = new SchemaBuilder().add(ScanTestUtils.LAST_MODIFIED_TIME_COL, MinorType.VARCHAR).addNullable(ScanTestUtils.PROJECT_METADATA_COL, MinorType.VARCHAR).add(ScanTestUtils.ROW_GROUP_INDEX_COL, MinorType.VARCHAR).add(ScanTestUtils.ROW_GROUP_START_COL, MinorType.VARCHAR).add(ScanTestUtils.ROW_GROUP_LENGTH_COL, MinorType.VARCHAR).build();
    RowSet expected = fixture.rowSetBuilder(expectedSchema).addRow("123456789", null, "10", "10000", "5000").addRow("123456789", null, "10", "10000", "5000").build();
    RowSetUtilities.verify(expected, fixture.wrap(batchLoader.outputContainer()));
}
Also used : TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder) RowSet(org.apache.drill.exec.physical.rowSet.RowSet) StaticBatchBuilder(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder) SubOperatorTest(org.apache.drill.test.SubOperatorTest) EvfTest(org.apache.drill.categories.EvfTest) Test(org.junit.Test)

Example 4 with StaticBatchBuilder

use of org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder in project drill by apache.

the class TestImplicitColumnLoader method testNonInternalColumns.

@Test
public void testNonInternalColumns() {
    StaticBatchBuilder batchLoader = buildHandler(ScanTestUtils.projectAllWithFileImplicit(3), MOCK_ROOT_PATH, MOCK_FILE_PATH);
    assertNotNull(batchLoader);
    batchLoader.load(2);
    TupleMetadata expectedSchema = new SchemaBuilder().add(ScanTestUtils.FULLY_QUALIFIED_NAME_COL, IMPLICIT_COL_TYPE).add(ScanTestUtils.FILE_PATH_COL, IMPLICIT_COL_TYPE).add(ScanTestUtils.FILE_NAME_COL, IMPLICIT_COL_TYPE).add(ScanTestUtils.SUFFIX_COL, IMPLICIT_COL_TYPE).add(ScanTestUtils.partitionColName(0), PARTITION_COL_TYPE).add(ScanTestUtils.partitionColName(1), PARTITION_COL_TYPE).add(ScanTestUtils.partitionColName(2), PARTITION_COL_TYPE).build();
    RowSet expected = fixture.rowSetBuilder(expectedSchema).addRow(MOCK_FILE_FQN, MOCK_FILE_DIR_PATH, MOCK_FILE_NAME, MOCK_SUFFIX, MOCK_DIR0, MOCK_DIR1, null).addRow(MOCK_FILE_FQN, MOCK_FILE_DIR_PATH, MOCK_FILE_NAME, MOCK_SUFFIX, MOCK_DIR0, MOCK_DIR1, null).build();
    RowSetUtilities.verify(expected, fixture.wrap(batchLoader.outputContainer()));
}
Also used : TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder) RowSet(org.apache.drill.exec.physical.rowSet.RowSet) StaticBatchBuilder(org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder) SubOperatorTest(org.apache.drill.test.SubOperatorTest) EvfTest(org.apache.drill.categories.EvfTest) Test(org.junit.Test)

Aggregations

EvfTest (org.apache.drill.categories.EvfTest)4 StaticBatchBuilder (org.apache.drill.exec.physical.impl.scan.v3.lifecycle.StaticBatchBuilder)4 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 SubOperatorTest (org.apache.drill.test.SubOperatorTest)4 Test (org.junit.Test)4