use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testArray.
@Test
public void testArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[1]", "a[3]"));
TupleMetadata projSet = result.dynamicSchema;
assertEquals(1, projSet.size());
ProjectedColumn a = (ProjectedColumn) projSet.metadata(0);
assertEquals("a", a.name());
assertTrue(a.isArray());
assertEquals(1, a.arrayDims());
assertFalse(a.isSimple());
assertFalse(a.isMap());
assertTrue(a.hasIndexes());
boolean[] indexes = a.indexes();
assertNotNull(indexes);
assertEquals(4, indexes.length);
assertFalse(indexes[0]);
assertTrue(indexes[1]);
assertFalse(indexes[2]);
assertTrue(indexes[3]);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testSimpleAndArray.
@Test
public void testSimpleAndArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a", "a[1]"));
doTestArrayAndSimple(result.dynamicSchema);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testMapAndArray.
@Test
public void testMapAndArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("m[0]", "m.a"));
doTestArrayAndMap(result.dynamicSchema);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testMultiDimArray.
@Test
public void testMultiDimArray() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectList("a[0][1][2]", "a[2][3]"));
TupleMetadata projSet = result.dynamicSchema;
assertEquals(1, projSet.size());
ProjectedColumn a = (ProjectedColumn) projSet.metadata(0);
assertEquals("a", a.name());
assertTrue(a.isArray());
// Dimension count is the maximum seen.
assertEquals(3, a.arrayDims());
assertFalse(a.isSimple());
assertFalse(a.isMap());
// Indexes only at the first dimension
boolean[] indexes = a.indexes();
assertNotNull(indexes);
assertEquals(3, indexes.length);
assertTrue(indexes[0]);
assertFalse(indexes[1]);
assertTrue(indexes[2]);
}
use of org.apache.drill.exec.physical.impl.scan.v3.schema.ScanProjectionParser.ProjectionParseResult in project drill by apache.
the class TestProjectionParser method testWildcard.
/**
* SELECT * means everything is projected
*/
@Test
public void testWildcard() {
ProjectionParseResult result = ScanProjectionParser.parse(RowSetTestUtils.projectAll());
assertEquals(0, result.wildcardPosn);
TupleMetadata projSet = result.dynamicSchema;
assertTrue(SchemaUtils.isProjectAll(projSet));
assertFalse(SchemaUtils.isProjectNone(projSet));
assertTrue(projSet.isEmpty());
}
Aggregations