I suppose that would work.  (I'll try it.)

But I was thinking more along the lines of "rec.clear()".

DR

On 08/09/2010 04:54 PM, Yang wrote:
like this??

foreach fieldKey
    rec.set(fieldKey, null);

On Mon, Aug 9, 2010 at 1:07 PM, David Rosenstrauch<[email protected]>  wrote:
There doesn't seem to be any method call available in the API for
GenericRecord to completely erase all of its data so that it can be reused.

I'm planning to use an Avro GenericRecord (GenericData.Record) inside a
Hadoop Reducer, and it would be much better from a memory usage perspective
if I could just clear the record's contents at the beginning of every
reduce() call, rather than having to instantiate a new one for each call.

Any way to make this happen?  (And if no, anyone think this is something
important enough that I should file a bug report on this?)

Thanks,

DR

Reply via email to