You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Blue (JIRA)" <ji...@apache.org> on 2014/11/14 01:18:33 UTC
[jira] [Updated] (AVRO-1604) ReflectData.AllowNull fails to
generate schemas when @Nullable is present.
[ https://issues.apache.org/jira/browse/AVRO-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ryan Blue updated AVRO-1604:
----------------------------
Attachment: AVRO-1604-1.patch
This patch implements the simple solution, to add handling to makeNullable that checks the schema and either wraps it in a union with null, adds null to an existing union, or returns the union that already includes null.
The other option is to update Schema.createUnion, but I think the current behavior is probably intended to catch errors as schemas are built.
> ReflectData.AllowNull fails to generate schemas when @Nullable is present.
> --------------------------------------------------------------------------
>
> Key: AVRO-1604
> URL: https://issues.apache.org/jira/browse/AVRO-1604
> Project: Avro
> Issue Type: Bug
> Reporter: Ryan Blue
> Attachments: AVRO-1604-1.patch
>
>
> The {{@Nullable}} annotation causes a failure because the {{makeNullable(Schema)}} method assumes that the type passed in is not already a union. When it is a union, either from using {{Nullable}}, {{AvroSchema}}, or a {{Union}}-annotated type, an exception is thrown that unions can't contain unions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)