avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robey Pointer <ro...@twitter.com>
Subject Re: how to fill in an array (list) from java
Date Tue, 13 Apr 2010 06:17:38 GMT
On 12 Apr 2010, at 09:40, Doug Cutting wrote:

> Robey Pointer wrote:
>> Maybe we should add a type of Array that implements the avro array interface but
doesn't require a schema?
> 
> Instances must know their schema in order to implement #equals(), #compareTo() and #hashCode()
consistently with their serialized form. This is because of unions.  Since different branches
of a union are not directly comparable, unions are ordered by branch.

It looks like those would mostly be useful for arrays on the read side (which will always
have the schema close at hand). Maybe the problem is for the write side, where the schema
isn't handy, and wouldn't be useful anyway unless you planned to keep a copy of the array
around after you wrote it.

Would it make sense to allow the schema arg to be null or missing for the write case, and
just throw an exception if you try to hashCode or compare a schema-less array?

robey


Mime
View raw message