avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Carey <sc...@richrelevance.com>
Subject Re: how to fill in an array (list) from java
Date Sat, 10 Apr 2010 00:03:56 GMT
The schema required by new GenericData.Array is the schema of the array, not the schema of
its elements.  

Try:
Schema.createArray(YOUR_ELEMENT_SCHEMA_HERE).


On Apr 7, 2010, at 9:20 PM, Robey Pointer wrote:

> As part of some performance testing I started doing (here: http://github.com/robey/avrotest),
I needed to build a list/array of structs from inside java. I ended up writing this:
> 
>  results.edges = new GenericData.Array[Edge](2, results.getSchema().getField("edges").schema())
> 
> which is obviously the wrong way to do it. :) It's just the only way I could figure out
from scanning the java source.
> 
> What's the right way to do that?
> 
> robey
> 


Mime
View raw message