[ 
https://issues.apache.org/jira/browse/AVRO-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eelco Hillenius updated AVRO-104:
---------------------------------

    Attachment: AVRO-104.patch

Uploaded patch with alternative solution. Works through a delegate 
'ReflectSchemaDelegate' you can set on ReflectData staticaly.

Imho, It would be more elegant to get rid of a lot of the use of static 
throughout the AVRO API, but that would mean quite a few breaks, and would make 
using AVRO also more verbose. This patch imho is a reasonable hack; not as ugly 
as setting schemas for fields directly, and more flexible.

People like me who want to allow null values of fields in objects they let AVRO 
write out, can do this:

      ReflectData.setReflectSchemaDelegate(
          ReflectSchemaDelegate.newNullAllowingInstance());

and AVRO will create a union for every field it comes across with 
introspection. Clients can also provide a custom strategy if they wish to do so.

> Reflective API can't handle nulls
> ---------------------------------
>
>                 Key: AVRO-104
>                 URL: https://issues.apache.org/jira/browse/AVRO-104
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.0.0, 1.0.1
>            Reporter: Eelco Hillenius
>             Fix For: 1.0.1
>
>         Attachments: AVRO-104.patch, AVRO-104.patch, AVRO-104.patch, 
> AVRO-104.patch, AVRO-104.patch
>
>
> It is currently not possible to have fields with null values when using the 
> reflective API.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to