Search in sources :

Example 41 with ProjectionFilter

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

the class TestSchemaTrackerProjection method testExplicit.

@Test
public void testExplicit() {
    ProjectionSchemaTracker tracker = schemaTracker(RowSetTestUtils.projectList("a", "b", "c"));
    assertSame(ScanSchemaTracker.ProjectionType.SOME, tracker.projectionType());
    assertTrue(0 < tracker.schemaVersion());
    TupleMetadata schema = tracker.internalSchema().toSchema();
    assertEquals(3, schema.size());
    assertTrue(schema.metadata(0).isDynamic());
    ProjectionFilter filter = tracker.projectionFilter(ERROR_CONTEXT);
    assertTrue(filter instanceof DynamicSchemaFilter);
}
Also used : ProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter) TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Example 42 with ProjectionFilter

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

the class TestSchemaTrackerProjection method testWildcardAndCols.

@Test
public void testWildcardAndCols() {
    ProjectionSchemaTracker tracker = schemaTracker(RowSetTestUtils.projectList("a", SchemaPath.DYNAMIC_STAR, "b"));
    assertFalse(tracker.isResolved());
    assertTrue(0 < tracker.schemaVersion());
    assertSame(ScanSchemaTracker.ProjectionType.ALL, tracker.projectionType());
    assertNotNull(tracker.columnProjection("a"));
    assertNotNull(tracker.columnProjection("b"));
    TupleMetadata schema = tracker.internalSchema().toSchema();
    assertEquals(2, schema.size());
    assertTrue(schema.metadata(0).isDynamic());
    ProjectionFilter filter = tracker.projectionFilter(ERROR_CONTEXT);
    assertTrue(filter instanceof DynamicSchemaFilter);
}
Also used : ProjectionFilter(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter) TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Aggregations

ProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter)42 EvfTest (org.apache.drill.categories.EvfTest)36 Test (org.junit.Test)36 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)35 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)33 BaseTest (org.apache.drill.test.BaseTest)24 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)13 SubOperatorTest (org.apache.drill.test.SubOperatorTest)12 ProjResult (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult)7 RequestedTuple (org.apache.drill.exec.physical.resultSet.project.RequestedTuple)6 UnresolvedColumn (org.apache.drill.exec.physical.impl.scan.project.AbstractUnresolvedColumn.UnresolvedColumn)5 UserException (org.apache.drill.common.exceptions.UserException)3 DynamicTupleFilter (org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter)3 ProjectionParseResult (org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult)2 RequestedColumn (org.apache.drill.exec.physical.resultSet.project.RequestedColumn)2 UnresolvedWildcardColumn (org.apache.drill.exec.physical.impl.scan.project.AbstractUnresolvedColumn.UnresolvedWildcardColumn)1