To permit null values you must use a union with null.

For example, if you want a field to be either an array of integers or null, then its type should be:

  ["null", {"type": "array", "items": "int"}]

Doug

Stephane L. wrote:
For a project we are investigating using Avro as the format for serializing/de-serializing data. I am currently testing with Avro 1.1.

I have been playing with GenericRecord and I have noticed that if I define a schema and let's say for example one property is an array, I will get a NullPointerException if at serialization time I did not put any data for that particular field aka myRecord.get("array") --> return null.

So my question is : when using a GenericRecord is it mandatory that all fields specified in the schema to be non null when serializiation is happening ?
Stéphane

Reply via email to