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()));
}
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()));
}
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()));
}
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()));
}
Aggregations