use of org.apache.drill.exec.record.metadata.MapColumnMetadata in project drill by axbaretto.
the class TestTupleSchema method testRepeatedMapColumn.
@Test
public void testRepeatedMapColumn() {
MaterializedField field = SchemaBuilder.columnSchema("m", MinorType.MAP, DataMode.REPEATED);
ColumnMetadata col = MetadataUtils.fromField(field);
assertTrue(col instanceof MapColumnMetadata);
assertNotNull(col.mapSchema());
assertEquals(0, col.mapSchema().size());
assertFalse(col.isNullable());
assertTrue(col.isArray());
assertFalse(col.isVariableWidth());
assertTrue(col.isMap());
assertFalse(col.isVariant());
assertEquals(0, col.expectedWidth());
col.setExpectedWidth(10);
assertEquals(0, col.expectedWidth());
assertEquals(ColumnMetadata.DEFAULT_ARRAY_SIZE, col.expectedElementCount());
col.setExpectedElementCount(2);
assertEquals(2, col.expectedElementCount());
}
use of org.apache.drill.exec.record.metadata.MapColumnMetadata in project drill by axbaretto.
the class TestTupleSchema method testMapColumn.
/**
* Tests a map column. Maps can only be required or repeated, not nullable.
* (But, the columns in the map can be nullable.)
*/
@Test
public void testMapColumn() {
MaterializedField field = SchemaBuilder.columnSchema("m", MinorType.MAP, DataMode.REQUIRED);
ColumnMetadata col = MetadataUtils.fromField(field);
assertTrue(col instanceof MapColumnMetadata);
assertNotNull(col.mapSchema());
assertEquals(0, col.mapSchema().size());
assertSame(col, col.mapSchema().parent());
MapColumnMetadata mapCol = (MapColumnMetadata) col;
assertNull(mapCol.parentTuple());
assertEquals(ColumnMetadata.StructureType.TUPLE, col.structureType());
assertFalse(col.isNullable());
assertFalse(col.isArray());
assertFalse(col.isVariableWidth());
assertTrue(col.isMap());
assertFalse(col.isVariant());
assertEquals(0, col.expectedWidth());
col.setExpectedWidth(10);
assertEquals(0, col.expectedWidth());
assertEquals(1, col.expectedElementCount());
col.setExpectedElementCount(2);
assertEquals(1, col.expectedElementCount());
}
Aggregations