use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectedPath method test3DArray.
@Test
public void test3DArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[0][1][2]"));
TupleMetadata projSet = result.dynamicSchema;
assertNotConsistent(projSet, INT_COLUMN);
assertNotConsistent(projSet, INT_ARRAY_COLUMN);
assertNotConsistent(projSet, MAP_COLUMN);
assertNotConsistent(projSet, MAP_ARRAY_COLUMN);
assertConsistent(projSet, UNION_COLUMN);
assertConsistent(projSet, LIST_COLUMN);
assertConsistent(projSet, DICT_INT_INT_COLUMN);
// TODO: Enforce specific DICT keys, if needed.
// assertDictNotConsistent(projSet, DICT_INT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_INT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_INT_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_VARCHAR_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_VARCHAR_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_VARCHAR_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_DOUBLE_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_DOUBLE_INT_COLUMN);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectedPath method test2DArray.
@Test
public void test2DArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[0][1]"));
TupleMetadata projSet = result.dynamicSchema;
assertNotConsistent(projSet, INT_COLUMN);
assertNotConsistent(projSet, INT_ARRAY_COLUMN);
assertNotConsistent(projSet, MAP_COLUMN);
assertNotConsistent(projSet, MAP_ARRAY_COLUMN);
assertConsistent(projSet, UNION_COLUMN);
assertConsistent(projSet, LIST_COLUMN);
assertConsistent(projSet, DICT_INT_INT_COLUMN);
// TODO: Enforce specific DICT keys, if needed.
// assertDictNotConsistent(projSet, DICT_INT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_INT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_INT_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_BIGINT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_VARCHAR_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_VARCHAR_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_VARCHAR_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_DOUBLE_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_DOUBLE_INT_COLUMN);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectedPath method testMap.
@Test
public void testMap() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a.b"));
TupleMetadata projSet = result.dynamicSchema;
assertNotConsistent(projSet, INT_COLUMN);
assertNotConsistent(projSet, INT_ARRAY_COLUMN);
assertConsistent(projSet, MAP_COLUMN);
assertConsistent(projSet, MAP_ARRAY_COLUMN);
// A UNION could contain a map, which would allow the
// a.b path to be valid.
assertConsistent(projSet, UNION_COLUMN);
// A LIST could be a list of MAPs, so a.b could mean
// to pick out the b column in all array entries.
assertConsistent(projSet, LIST_COLUMN);
assertConsistent(projSet, DICT_INT_INT_COLUMN);
// TODO: Enforce specific DICT keys, if needed.
// assertDictNotConsistent(projSet, DICT_INT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_INT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_INT_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_BIGINT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_VARCHAR_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_VARCHAR_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_VARCHAR_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_DOUBLE_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_DOUBLE_INT_COLUMN);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectedPath method testMapArray.
@Test
public void testMapArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[0].b"));
TupleMetadata projSet = result.dynamicSchema;
assertNotConsistent(projSet, INT_COLUMN);
assertNotConsistent(projSet, INT_ARRAY_COLUMN);
assertNotConsistent(projSet, MAP_COLUMN);
assertConsistent(projSet, MAP_ARRAY_COLUMN);
// A UNION could contain a repeated map, which would allow the
// a.b path to be valid.
assertConsistent(projSet, UNION_COLUMN);
// A LIST could contain MAPs.
assertConsistent(projSet, LIST_COLUMN);
assertConsistent(projSet, DICT_INT_INT_COLUMN);
// TODO: Enforce specific DICT keys, if needed.
// assertDictNotConsistent(projSet, DICT_INT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_INT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_INT_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_BIGINT_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_VARCHAR_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_VARCHAR_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_VARCHAR_INT_ARRAY_COLUMN);
// assertDictNotConsistent(projSet, DICT_DOUBLE_INT_COLUMN);
// assertDictNotConsistent(projSet, DICT_ARRAY_DOUBLE_INT_COLUMN);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult 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