use of com.linkedin.haivvreo.AvroObjectInspectorGenerator in project haivvreo by jghoman.
the class TestAvroObjectInspectorGenerator method convertsNullableTypes.
// That Union[T, NULL] is converted to just T.
@Test
public void convertsNullableTypes() throws SerDeException {
Schema s = Schema.parse(NULLABLE_STRING_SCHEMA);
AvroObjectInspectorGenerator aoig = new AvroObjectInspectorGenerator(s);
assertEquals(1, aoig.getColumnNames().size());
assertEquals("nullableString", aoig.getColumnNames().get(0));
// Column types
assertEquals(1, aoig.getColumnTypes().size());
TypeInfo typeInfo = aoig.getColumnTypes().get(0);
assertTrue(typeInfo instanceof PrimitiveTypeInfo);
PrimitiveTypeInfo pti = (PrimitiveTypeInfo) typeInfo;
// Verify the union has been hidden and just the main type has been returned.
assertEquals(PrimitiveObjectInspector.PrimitiveCategory.STRING, pti.getPrimitiveCategory());
}
Aggregations