@Test public void toTypeSchemaArrayNullable() throws Exception { Schema schema = AvroUtils.typeFor(DataTypes.createArrayType(DataTypes.IntegerType, false)); assertEquals("Invalid type", Schema.Type.UNION, schema.getType()); assertEquals("Invalid union size", 2, schema.getTypes().size()); for (Schema s : schema.getTypes()) { assertThat("Invalid union types", s.getType(), anyOf(is(Schema.Type.ARRAY), is(Schema.Type.NULL))); if (s.getType().equals(Schema.Type.ARRAY)) { assertEquals("Invalid element type", Schema.Type.INT, s.getElementType().getType()); } } }
public static Schema typeFor(DataType dataType) { return typeFor(dataType, true); }
AvroUtils { public static Schema typeFor(DataType dataType) { return typeFor(dataType, true); } }
AvroUtils { public static Schema typeFor(DataType dataType) { return typeFor(dataType, true); }  }
AvroUtils { public static Schema typeFor(DataType dataType) { return typeFor(dataType, true); }  static Schema schemaFor(StructType structType); static Schema schemaFor(StructType structType, String record, String namespace); static Schema typeFor(DataType dataType); static Schema typeFor(DataType dataType, boolean isOptional); static StructType structTypeFor(Schema schema); static DataType dataTypeFor(Schema schemaType); }
AvroUtils { public static Schema typeFor(DataType dataType) { return typeFor(dataType, true); }  static Schema schemaFor(StructType structType); static Schema schemaFor(StructType structType, String record, String namespace); static Schema typeFor(DataType dataType); static Schema typeFor(DataType dataType, boolean isOptional); static StructType structTypeFor(Schema schema); static DataType dataTypeFor(Schema schemaType);  }