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

Switch to Threaded View
Avro >> mail # user >> How to add optional new record fields and/or new methods in avro-ipc?

Copy link to this message
Re: How to add optional new record fields and/or new methods in avro-ipc?

On 10/18/11 10:38 AM, "Doug Cutting" <[EMAIL PROTECTED]> wrote:

>On 10/18/2011 10:09 AM, Scott Carey wrote:
>> On 10/18/11 9:47 AM, "Doug Cutting" <[EMAIL PROTECTED]> wrote:
>>> To amend this, you can use Avro's @Nullable annotation:
>> The problem is that this does not provide the ability to evolve schemas
>> you add a field
>> since you would need @Default or something similar, as well:
>> @Nullable
>> @Default(null)
>I don't think this is required.  The default value for a union is the
>default value for its first branch.  A "null" schema needs no default.
>So the schema ["null", "string"] needs to specify no default value while
>the schema ["string", "null"] does.  Thus the best practice for nullable
>values is to place the null first in the union.  This is what is done by
>the @Nullable annotation.
>Perhaps we should clarify this in the Specification?  We might state
>that a "null" schema implicitly has a default value of null since that's
>the only value its ever permitted to have anyway.

Good to know.

So, any ideas what is causing the original User's problem?  @Nullable is
in use with Reflect (does not work), Specific works (with default values
but not without -- it appears to have "null" first but not confirmed).
I suspect there is something else going on.

>> Does reflect have any concept of default values?
>No.  We could add an @Default annotation, I suppose.  But I don't think
>this is needed for nullable stuff.