use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter in project drill by apache.
the class TestProjectionFilter method testBuilders.
@Test
public void testBuilders() {
assertSame(ProjectionFilter.PROJECT_ALL, ProjectionFilter.projectionFilter(Projections.projectAll(), EmptyErrorContext.INSTANCE));
assertSame(ProjectionFilter.PROJECT_NONE, ProjectionFilter.projectionFilter(Projections.projectNone(), EmptyErrorContext.INSTANCE));
assertTrue(ProjectionFilter.projectionFilter(Projections.parse(RowSetTestUtils.projectList("a")), EmptyErrorContext.INSTANCE) instanceof DirectProjectionFilter);
TupleMetadata schema = new SchemaBuilder().add(A_COL.copy()).add(B_COL.copy()).build();
assertSame(ProjectionFilter.PROJECT_NONE, ProjectionFilter.definedSchemaFilter(new TupleSchema(), EmptyErrorContext.INSTANCE));
assertTrue(ProjectionFilter.definedSchemaFilter(schema, EmptyErrorContext.INSTANCE) instanceof SchemaProjectionFilter);
assertTrue(ProjectionFilter.providedSchemaFilter(Projections.projectAll(), schema, EmptyErrorContext.INSTANCE) instanceof CompoundProjectionFilter);
assertSame(ProjectionFilter.PROJECT_NONE, ProjectionFilter.providedSchemaFilter(Projections.projectNone(), schema, EmptyErrorContext.INSTANCE));
assertSame(ProjectionFilter.PROJECT_ALL, ProjectionFilter.providedSchemaFilter(Projections.projectAll(), new TupleSchema(), EmptyErrorContext.INSTANCE));
TupleMetadata strictEmpty = new TupleSchema();
strictEmpty.setBooleanProperty(TupleMetadata.IS_STRICT_SCHEMA_PROP, true);
assertSame(ProjectionFilter.PROJECT_NONE, ProjectionFilter.providedSchemaFilter(Projections.projectAll(), strictEmpty, EmptyErrorContext.INSTANCE));
assertTrue(ProjectionFilter.providedSchemaFilter(Projections.parse(RowSetTestUtils.projectList("a")), schema, EmptyErrorContext.INSTANCE) instanceof CompoundProjectionFilter);
}
use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter in project drill by apache.
the class TestProjectionFilter method testCompoundFilterMixed1.
@Test
public void testCompoundFilterMixed1() {
ProjectionFilter filter = new CompoundProjectionFilter(ProjectionFilter.PROJECT_ALL, ProjectionFilter.PROJECT_NONE);
assertFalse(filter.isProjected("a"));
assertFalse(filter.projection(A_COL).isProjected);
assertTrue(filter.isEmpty());
ProjResult result = filter.projection(MAP_COL);
assertFalse(result.isProjected);
assertSame(ProjectionFilter.PROJECT_NONE, result.mapFilter);
}
use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter in project drill by apache.
the class TestProjectionFilter method testCompoundMap.
@Test
public void testCompoundMap() {
TupleMetadata schema = new SchemaBuilder().add(A_COL.copy()).add(B_COL.copy()).addMap("m").add("a", MinorType.INT).add("b", MinorType.INT).resumeSchema().build();
ProjectionFilter filter = new CompoundProjectionFilter(new DirectProjectionFilter(Projections.parse(RowSetTestUtils.projectList("a", "c", "m.a")), EmptyErrorContext.INSTANCE), new SchemaProjectionFilter(schema, EmptyErrorContext.INSTANCE));
ProjResult result = filter.projection(MAP_COL);
assertTrue(result.isProjected);
assertTrue(result.mapFilter.isProjected("a"));
}
use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter in project drill by apache.
the class TestProjectionFilter method testCompoundFilterMixed2.
@Test
public void testCompoundFilterMixed2() {
ProjectionFilter filter = new CompoundProjectionFilter(ProjectionFilter.PROJECT_NONE, ProjectionFilter.PROJECT_ALL);
assertFalse(filter.isProjected("a"));
assertFalse(filter.projection(A_COL).isProjected);
assertTrue(filter.isEmpty());
ProjResult result = filter.projection(MAP_COL);
assertFalse(result.isProjected);
assertSame(ProjectionFilter.PROJECT_NONE, result.mapFilter);
}
use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter in project drill by apache.
the class TestProjectionFilter method testCompoundPermissive.
@Test
public void testCompoundPermissive() {
ProjectionFilter filter = new CompoundProjectionFilter(ProjectionFilter.PROJECT_ALL, ProjectionFilter.PROJECT_ALL);
assertTrue(filter.isProjected("a"));
assertTrue(filter.projection(A_COL).isProjected);
ColumnMetadata specialCol = MetadataUtils.newScalar("special", Types.optional(MinorType.BIGINT));
specialCol.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
assertFalse(filter.projection(specialCol).isProjected);
assertFalse(filter.isEmpty());
ProjResult result = filter.projection(MAP_COL);
assertTrue(result.isProjected);
assertSame(ProjectionFilter.PROJECT_ALL, result.mapFilter);
}
Aggregations