Search in sources :

Example 26 with ProjectionParseResult

use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.

the class TestProjectionParser method testProjectionAll.

/**
 * Null map means everything is projected
 */
@Test
public void testProjectionAll() {
    ProjectionParseResult result = ScanProjectionParser.parse(null);
    assertEquals(0, result.wildcardPosn);
    TupleMetadata projSet = result.dynamicSchema;
    assertTrue(SchemaUtils.isProjectAll(projSet));
    assertFalse(SchemaUtils.isProjectNone(projSet));
    assertTrue(projSet.isEmpty());
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) 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 27 with ProjectionParseResult

use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.

the class TestProjectionParser method testProjectionNone.

/**
 * Test an empty projection which occurs in a
 * SELECT COUNT(*) query.
 * Empty list means nothing is projected.
 */
@Test
public void testProjectionNone() {
    ProjectionParseResult result = ScanProjectionParser.parse(Collections.emptyList());
    assertEquals(-1, result.wildcardPosn);
    TupleMetadata projSet = result.dynamicSchema;
    assertFalse(SchemaUtils.isProjectAll(projSet));
    assertTrue(SchemaUtils.isProjectNone(projSet));
    assertTrue(projSet.isEmpty());
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) 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 28 with ProjectionParseResult

use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.

the class TestProjectedPath method testSimplePath.

@Test
public void testSimplePath() {
    ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a"));
    TupleMetadata projSet = result.dynamicSchema;
    assertAllConsistent(projSet);
    // No constraints on an unprojected column.
    assertTrue(isConsistent(projSet, MetadataUtils.newScalar("b", Types.required(MinorType.INT))));
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) 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 29 with ProjectionParseResult

use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.

the class TestProjectedPath method test1DArray.

@Test
public void test1DArray() {
    ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[0]"));
    TupleMetadata projSet = result.dynamicSchema;
    assertNotConsistent(projSet, INT_COLUMN);
    assertConsistent(projSet, INT_ARRAY_COLUMN);
    assertNotConsistent(projSet, MAP_COLUMN);
    assertConsistent(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.
// assertDictConsistent(projSet, DICT_INT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_INT_INT_COLUMN);
// assertDictConsistent(projSet, DICT_ARRAY_INT_INT_ARRAY_COLUMN);
// assertDictConsistent(projSet, DICT_BIGINT_INT_COLUMN);
// assertDictConsistent(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);
// assertDictConsistent(projSet, DICT_ARRAY_DOUBLE_INT_COLUMN);
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) 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 30 with ProjectionParseResult

use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.

the class TestProjectedPath method testProjectNone.

@Test
public void testProjectNone() {
    ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectNone());
    // No constraints on empty projection
    assertAllConsistent(result.dynamicSchema);
}
Also used : ProjectionParseResult(org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) EvfTest(org.apache.drill.categories.EvfTest)

Aggregations

EvfTest (org.apache.drill.categories.EvfTest)31 ProjectionParseResult (org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult)31 BaseTest (org.apache.drill.test.BaseTest)31 Test (org.junit.Test)31 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)21 ArrayList (java.util.ArrayList)2 SchemaPath (org.apache.drill.common.expression.SchemaPath)2 DynamicTupleFilter (org.apache.drill.exec.physical.impl.scan.v3.schema.DynamicSchemaFilter.DynamicTupleFilter)2 ProjectionFilter (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter)2 ProjResult (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult)2 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)1