use of org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter in project drill by apache.
the class ScanSchemaResolver method mergeWithConcrete.
/**
* Merge an incoming column with an existing resolved column. Non-map columns
* must match. Maps are merged recursively.
*/
private void mergeWithConcrete(ColumnMetadata existing, ColumnMetadata revised) {
SchemaUtils.verifyConsistency(existing, revised, source, errorContext);
if (existing.isMap()) {
ProjectionFilter filter = new DynamicTupleFilter(existing.tupleSchema(), allowMapAdditions, errorContext, source);
expandMapProjection(existing.tupleSchema(), filter, revised.tupleSchema());
}
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter 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);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter in project drill by apache.
the class TestDynamicSchemaFilter method testProjectList.
@Test
public void testProjectList() {
ProjectionParseResult parseResult = ScanProjectionParser.parse(RowSetTestUtils.projectList("a", "c", "m", "special"));
ProjectionFilter filter = new DynamicTupleFilter(parseResult.dynamicSchema, EmptyErrorContext.INSTANCE);
assertFalse(filter.isEmpty());
assertTrue(filter.isProjected(A_COL.name()));
ProjResult result = filter.projection(A_COL);
assertTrue(result.isProjected);
assertNotNull(result.projection);
assertTrue(result.projection.isDynamic());
assertEquals(A_COL.name(), result.projection.name());
assertFalse(filter.isProjected(B_COL.name()));
result = filter.projection(B_COL);
assertFalse(result.isProjected);
assertTrue(filter.isProjected(MAP_COL.name()));
result = filter.projection(MAP_COL);
assertTrue(result.isProjected);
assertNotNull(result.projection);
assertTrue(result.projection.isDynamic());
assertEquals(MAP_COL.name(), result.projection.name());
assertSame(ProjectionFilter.PROJECT_ALL, result.mapFilter);
assertTrue(filter.isProjected(SPECIAL_COLUMN.name()));
result = filter.projection(SPECIAL_COLUMN);
assertTrue(result.isProjected);
assertNotNull(result.projection);
assertTrue(result.projection.isDynamic());
assertEquals(SPECIAL_COLUMN.name(), result.projection.name());
assertFalse(filter.isProjected(SPECIAL_COLUMN2.name()));
result = filter.projection(SPECIAL_COLUMN2);
assertFalse(result.isProjected);
}
Aggregations