use of org.apache.drill.exec.physical.impl.scan.v3.file.ImplicitColumnResolver.ParseResult in project drill by apache.
the class TestImplicitColumnResolver method testLegacyWildcardAndImplicitColsMixed.
/**
* As above, but include implicit columns before and after the wildcard.
* Include both a wildcard and a partition column. The wildcard, in legacy
* mode, will create partition columns for any partitions not mentioned in the
* project list.
*/
@Test
public void testLegacyWildcardAndImplicitColsMixed() {
ParserFixture parseFixture = new ParserFixture(RowSetTestUtils.projectList(ScanTestUtils.FILE_NAME_COL, SchemaPath.DYNAMIC_STAR, ScanTestUtils.SUFFIX_COL, ScanTestUtils.partitionColName(0)));
parseFixture.options.maxPartitionDepth(3).useLegacyWildcardExpansion(true);
ParseResult result = parseFixture.parseImplicit();
TupleMetadata expected = new SchemaBuilder().add(ScanTestUtils.FILE_NAME_COL, MinorType.VARCHAR).addNullable(ScanTestUtils.partitionColName(1), MinorType.VARCHAR).addNullable(ScanTestUtils.partitionColName(2), MinorType.VARCHAR).add(ScanTestUtils.SUFFIX_COL, MinorType.VARCHAR).addNullable(ScanTestUtils.partitionColName(0), MinorType.VARCHAR).build();
assertEquals(expected, result.schema());
}
use of org.apache.drill.exec.physical.impl.scan.v3.file.ImplicitColumnResolver.ParseResult in project drill by apache.
the class TestImplicitColumnResolver method testImplicitOnly.
@Test
public void testImplicitOnly() {
ParserFixture parseFixture = new ParserFixture(RowSetTestUtils.projectList(ScanTestUtils.FULLY_QUALIFIED_NAME_COL, ScanTestUtils.FILE_NAME_COL));
ParseResult result = parseFixture.parseImplicit();
assertEquals(2, result.columns().size());
assertTrue(parseFixture.tracker.isResolved());
assertSame(ProjectionType.NONE, parseFixture.tracker.projectionType());
}
use of org.apache.drill.exec.physical.impl.scan.v3.file.ImplicitColumnResolver.ParseResult in project drill by apache.
the class TestImplicitColumnResolver method testNoImplicitCols.
@Test
public void testNoImplicitCols() {
ParserFixture parseFixture = new ParserFixture(RowSetTestUtils.projectList("a", "b", "c"));
ParseResult result = parseFixture.parseImplicit();
assertTrue(result.columns().isEmpty());
assertTrue(result.schema().isEmpty());
assertFalse(result.isMetadataScan());
}
use of org.apache.drill.exec.physical.impl.scan.v3.file.ImplicitColumnResolver.ParseResult in project drill by apache.
the class TestImplicitColumnResolver method testLegacyWildcardAndImplictCols.
/**
* Combine wildcard and file metadata columns. The wildcard expands
* table columns but not metadata columns.
*/
@Test
public void testLegacyWildcardAndImplictCols() {
ParserFixture parseFixture = new ParserFixture(RowSetTestUtils.projectList(SchemaPath.DYNAMIC_STAR, ScanTestUtils.FILE_NAME_COL, ScanTestUtils.SUFFIX_COL));
parseFixture.options.maxPartitionDepth(2).useLegacyWildcardExpansion(true);
ParseResult result = parseFixture.parseImplicit();
TupleMetadata expected = new SchemaBuilder().addNullable(ScanTestUtils.partitionColName(0), MinorType.VARCHAR).addNullable(ScanTestUtils.partitionColName(1), MinorType.VARCHAR).add(ScanTestUtils.FILE_NAME_COL, MinorType.VARCHAR).add(ScanTestUtils.SUFFIX_COL, MinorType.VARCHAR).build();
assertEquals(expected, result.schema());
}
use of org.apache.drill.exec.physical.impl.scan.v3.file.ImplicitColumnResolver.ParseResult in project drill by apache.
the class TestDynamicSchemaFilter method testMapProjectList.
@Test
public void testMapProjectList() {
ProjectionParseResult parseResult = ScanProjectionParser.parse(RowSetTestUtils.projectList("m.x"));
ProjectionFilter filter = new DynamicTupleFilter(parseResult.dynamicSchema, EmptyErrorContext.INSTANCE);
assertFalse(filter.isEmpty());
assertTrue(filter.isProjected(MAP_COL.name()));
ProjResult result = filter.projection(MAP_COL);
assertTrue(result.isProjected);
assertNotNull(result.projection);
assertTrue(result.projection.isDynamic());
assertEquals(MAP_COL.name(), result.projection.name());
assertTrue(result.mapFilter instanceof DynamicTupleFilter);
ProjectionFilter mapFilter = result.mapFilter;
ColumnMetadata x_col = MAP_COL.tupleSchema().metadata("x");
assertTrue(mapFilter.isProjected("x"));
result = mapFilter.projection(x_col);
assertTrue(result.isProjected);
assertNotNull(result.projection);
assertTrue(result.projection.isDynamic());
assertEquals(x_col.name(), result.projection.name());
ColumnMetadata y_col = MAP_COL.tupleSchema().metadata("y");
assertFalse(mapFilter.isProjected("y"));
result = mapFilter.projection(y_col);
assertFalse(result.isProjected);
}
Aggregations