Reputation: 145
I have an avdl file which has a record, say person that contains a string variable, "address", which is optional.
This person record is then used in another record say city, as an array which can be nullable (used union with default value null).
when I try to serialize with dataFileWriter.append(object), avro throws me an error: java.lang.NullPointerException: null of string in field address of person of array of union in field persons of city.
Since I'm new to avro, I'm not quite sure if i can have an optional field as a string (Didn't really find it on the wiki).
Upvotes: 1
Views: 1319
Reputation: 145
Just realized I have to make it nullable using
union{null, String} address;
Upvotes: 3