Hi Lewis,
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. 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.
Thanks,
Alparslan.
On 20-01-2014 13:33, Lewis John Mcgibbney wrote:
Hey Alparslan,
I wonder if this answers your question?
This is something which we need to sort out but I've not seen any
follow up on Avro or Gora lists.
Thanks
Lewis
On Thu, Jan 16, 2014 at 1:21 PM, Harsh J <[email protected]
<mailto:[email protected]>> wrote:
Hi Alparisian,
Are you looking for the Nullable annotation for ReflectData based
schemas:
http://avro.apache.org/docs/1.7.5/api/java/org/apache/avro/reflect/Nullable.html?
Sample usage here:
https://github.com/apache/avro/blob/release-1.7.5/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java#L324
On Thu, Jan 16, 2014 at 5:27 PM, Alparslan Avcı
<[email protected] <mailto:[email protected]>> wrote:
> Hi all,
> I've been developing Gora to upgrade Avro 1.7.x and have a
question. Why do
> we have to use UNION type (Ex.: {"name": "field1", "type": ["null",
> {"type":"map", "values":["null", "string"]}],"default":null})
for nullable
> fields? Because of this issue, we have to handle UNION types in an
> appropriate way both normal values and null values as exceptions.
>
> Instead of UNION type, why don't we use a 'nullable' property
for any field?
--
Harsh J
--
/Lewis/