avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: how to fill in an array (list) from java
Date Mon, 12 Apr 2010 16:40:31 GMT
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.

> I'm pushing on this because if you look at my sample code, it's by far the ugliest part
of assembling a reply.

Perhaps we can instead work to simplify schema constructors?  For 
example, we might support something like:

   Schema.arrayOf(Type.INTEGER)

Similarly, we could add a unionOf that uses varargs, e.g.:

   Schema.unionOf(Type.NULL, Type.STRING);

Could such things help?

Doug



Mime
View raw message