use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testProjectionMapAndSimple.
/**
* Project both a map member and the entire map.
*/
@Test
public void testProjectionMapAndSimple() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("map.a", "map"));
doTestMapAndSimple(result.dynamicSchema);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testProjectionMapSubset.
/**
* Selected map projection, multiple levels, full projection
* at leaf level.
*/
@Test
public void testProjectionMapSubset() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("map.a", "map.b", "map.map2.x"));
TupleMetadata projSet = result.dynamicSchema;
// Map itself is projected and has a map qualifier
ProjectedColumn map = (ProjectedColumn) projSet.metadata("map");
assertNotNull(map);
// Map: an explicit map-like at top level
assertTrue(map.isMap());
TupleMetadata mapProj = map.tupleSchema();
assertNotNull(mapProj);
assertFalse(SchemaUtils.isProjectAll(mapProj));
assertFalse(SchemaUtils.isProjectNone(mapProj));
assertNotNull(mapProj.metadata("a"));
assertNotNull(mapProj.metadata("b"));
assertNotNull(mapProj.metadata("map2"));
assertNull(mapProj.metadata("bogus"));
// Map b: an implied nested map
ProjectedColumn b = (ProjectedColumn) mapProj.metadata("b");
assertTrue(b.isSimple());
// Map2, an nested map, has an explicit projection
ProjectedColumn map2 = (ProjectedColumn) mapProj.metadata("map2");
TupleMetadata map2Proj = map2.tupleSchema();
assertNotNull(map2Proj);
assertFalse(SchemaUtils.isProjectAll(map2Proj));
assertNotNull(map2Proj.metadata("x"));
assertNull(map2Proj.metadata("bogus"));
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testArrayAndSimple.
@Test
public void testArrayAndSimple() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[1]", "a"));
doTestArrayAndSimple(result.dynamicSchema);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testProjectionSimpleAndMap.
/**
* Project both an entire map and a map member.
*/
@Test
public void testProjectionSimpleAndMap() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("map", "map.a"));
doTestMapAndSimple(result.dynamicSchema);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult 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