Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # dev >> Default encapsulation of strings fields into unions


Copy link to this message
-
Default encapsulation of strings fields into unions
Hi,

Assume I have the following schema:

{
  "name": "Foo",
  "type":"record",
  "fields":[ {"name": "Bar", "type":"string"} ]
}

Since a string can be null, will Avro (Java implementation) encapsulate Bar in a union? (i.e. type of Bar field will be regarded as ["null", "string"]).

I am almost certain that it should not because it will lead to inconsistencies with encoding/decoding but I want to make sure.

Another question, what happens when we want to deserialize a null string?

Best regards,
Youssef Hatem