avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Kenworthy <adwkenwor...@yahoo.com>
Subject Collecting union-ed Records in AvroReducer
Date Thu, 08 Dec 2011 12:10:52 GMT

is it possible to write/collect a union-ed record from an avro reducer?

I have a reduce class (extending AvroReducer), and the output schema is a union schema of
record type A and record type B. In the reduce logic I want to combine instances of A and
B in the same datum, passing it to my Avrocollector. My code looks a bit like this:

Record unionRecord = new GenericData.Record(myUnionSchema); // not legal!
unionRecord.put("type A", recordA);
unionRecord.put("type B", recordB);


but GenericData.Record constructor expects a Record Schema. How can I write both records such
that they appear in the same output datum?

View raw message