Hallo,

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);

collector.collect(unionRecord);

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

Andrew

Reply via email to