Search in sources :

Example 1 with UnionBuilder

use of org.apache.drill.exec.record.metadata.UnionBuilder in project drill by apache.

the class TestSchemaBuilder method testStandaloneUnionBuilder.

@Test
public void testStandaloneUnionBuilder() {
    ColumnMetadata columnMetadata = new UnionBuilder("u", MinorType.UNION).addType(MinorType.INT).addType(MinorType.VARCHAR).buildColumn();
    assertEquals("u", columnMetadata.name());
    assertTrue(columnMetadata.isVariant());
    VariantMetadata variantMetadata = columnMetadata.variantSchema();
    assertTrue(variantMetadata.hasType(MinorType.INT));
    assertTrue(variantMetadata.hasType(MinorType.VARCHAR));
}
Also used : VariantMetadata(org.apache.drill.exec.record.metadata.VariantMetadata) ColumnMetadata(org.apache.drill.exec.record.metadata.ColumnMetadata) UnionBuilder(org.apache.drill.exec.record.metadata.UnionBuilder) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Aggregations

ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)1 UnionBuilder (org.apache.drill.exec.record.metadata.UnionBuilder)1 VariantMetadata (org.apache.drill.exec.record.metadata.VariantMetadata)1 DrillTest (org.apache.drill.test.DrillTest)1 Test (org.junit.Test)1