Search in sources :

Example 11 with ProjResult

use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult 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);
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) ProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter) DynamicTupleFilter(org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Example 12 with ProjResult

use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult in project drill by apache.

the class TestDynamicSchemaFilter method testEmptyProjectList.

@Test
public void testEmptyProjectList() {
    ProjectionFilter filter = ProjectionFilter.PROJECT_NONE;
    assertTrue(filter.isEmpty());
    assertFalse(filter.isProjected(A_COL.name()));
    ProjResult result = filter.projection(A_COL);
    assertFalse(result.isProjected);
    assertFalse(filter.isProjected(MAP_COL.name()));
    result = filter.projection(MAP_COL);
    assertFalse(result.isProjected);
    assertSame(ProjectionFilter.PROJECT_NONE, result.mapFilter);
    assertFalse(filter.isProjected(SPECIAL_COLUMN.name()));
    result = filter.projection(SPECIAL_COLUMN);
    assertFalse(result.isProjected);
}
Also used : ProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Example 13 with ProjResult

use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult in project drill by apache.

the class TestDynamicSchemaFilter method testProjectAll.

@Test
public void testProjectAll() {
    ProjectionFilter filter = ProjectionFilter.PROJECT_ALL;
    assertFalse(filter.isEmpty());
    assertTrue(filter.isProjected(A_COL.name()));
    ProjResult result = filter.projection(A_COL);
    assertTrue(result.isProjected);
    assertNull(result.projection);
    assertTrue(filter.isProjected(MAP_COL.name()));
    result = filter.projection(MAP_COL);
    assertTrue(result.isProjected);
    assertNull(result.projection);
    assertSame(ProjectionFilter.PROJECT_ALL, result.mapFilter);
    // "Special" columns are projected only by name, but rely on
    // a property in the column itself, so give inconsistent answers
    // from the filter.
    assertTrue(filter.isProjected(SPECIAL_COLUMN.name()));
    result = filter.projection(SPECIAL_COLUMN);
    assertFalse(result.isProjected);
}
Also used : ProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Example 14 with ProjResult

use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult 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"));
}
Also used : SchemaProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.SchemaProjectionFilter) DirectProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.DirectProjectionFilter) SchemaProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.SchemaProjectionFilter) TypeProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.TypeProjectionFilter) DirectProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.DirectProjectionFilter) CompoundProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter) TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) CompoundProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest)

Example 15 with ProjResult

use of org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult in project drill by apache.

the class TestProjectionFilter method testImplicitNone.

@Test
public void testImplicitNone() {
    ProjectionFilter filter = 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);
}
Also used : SchemaProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.SchemaProjectionFilter) TypeProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.TypeProjectionFilter) DirectProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.DirectProjectionFilter) CompoundProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest)

Aggregations

ProjResult (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult)22 BaseTest (org.apache.drill.test.BaseTest)17 Test (org.junit.Test)17 CompoundProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.CompoundProjectionFilter)11 DirectProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.DirectProjectionFilter)11 SchemaProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.SchemaProjectionFilter)11 TypeProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.TypeProjectionFilter)11 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)10 ProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter)7 EvfTest (org.apache.drill.categories.EvfTest)6 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)6 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)6 ListVectorState (org.apache.drill.exec.physical.resultSet.impl.ListState.ListVectorState)4 RepeatedListVectorState (org.apache.drill.exec.physical.resultSet.impl.RepeatedListState.RepeatedListVectorState)4 OffsetVectorState (org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.OffsetVectorState)4 SimpleVectorState (org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.SimpleVectorState)4 MapVectorState (org.apache.drill.exec.physical.resultSet.impl.TupleState.MapVectorState)4 UnionVectorState (org.apache.drill.exec.physical.resultSet.impl.UnionState.UnionVectorState)4 PrimitiveColumnMetadata (org.apache.drill.exec.record.metadata.PrimitiveColumnMetadata)3 UInt4Vector (org.apache.drill.exec.vector.UInt4Vector)3