avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lewis John Mcgibbney <lewis.mcgibb...@gmail.com>
Subject Re: Nullable Fields
Date Tue, 21 Jan 2014 19:21:31 GMT
Hi Alparslan,

On Mon, Jan 20, 2014 at 11:50 AM, Alparslan Avc─▒
<alparslan.avci@agmlab.com>wrote:

>
> Actually, the answer is not quite enough for me, because I wanted to learn
> about why UNION type is used for representing nullable fields in JSON
> schemas.
>

>From my perspective it is simple. At the time I knew of no better way to do
it. Then I found out about default:null, then realized we get NPE when some
data types are null e.g. Map.


> This approach may be used in order to provide other (which I don't know)
> requirements, however I think that a 'nullable' property will suffice
> instead. For example;
>
> {"name": "field1", "type": ["null", {"type":"map", "values":["null",
> "string"]}],"default":null}
>
> can be represented as like
>
> {"name": "field1", "type": {"type":"map", "values":"string",
> "nullable":true}, "nullable":true, "default":null}
>
> Null types in unions will always cause an exceptional situation since they
> are not 'types' at all.
>
> Absolutely. It would be really appreciated if someone (more expereienced
than myself) could determine the concrete differences between the cases
Alparslan has mentioned above. I cannot answer the question right now as I
am still learning more about newer Avro code.
Lewis

Mime
View raw message