-Re: Joining Avro input files in using Java mapreduce
Martin Kleppmann 2013-04-25, 14:43
Oh, sorry, you're right. I was too hasty.
One approach that I've used for joining Avro inputs is to use regular
Hadoop mappers and reducers (instead of AvroMapper/AvroReducer) with
MultipleInputs and AvroInputFormat. Your mapper input key type is then
AvroWrapper<GenericRecord>, and mapper input value type is NullWritable.
This approach uses Hadoop sequence files (rather than Avro files) between
mappers and reducers, so you have to take care of serializing mapper output
and unserializing reducer input yourself. It works, but you have to write
quite a bit of annoying boilerplate code.
I'd also be interested if anyone has a better solution. Perhaps we just
need to create the AvroMultipleInputs that I thought existed, but doesn't :)
On 24 April 2013 12:02, Sripad Sriram <[EMAIL PROTECTED]> wrote:
> Hey Martin,
> I think those classes refer to outputting to multiple files rather than
> reading from multiple files, which is what's needed for a reduce-side join.
> On Wed, Apr 24, 2013 at 3:35 AM, Martin Kleppmann <[EMAIL PROTECTED]>wrote:
>> Hey Sripad,
>> Take a look at AvroMultipleInputs.
>> http://avro.apache.org/docs/1.7.4/api/java/org/apache/avro/mapred/AvroMultipleOutputs.html(mapred version)
>> http://avro.apache.org/docs/1.7.4/api/java/org/apache/avro/mapreduce/AvroMultipleOutputs.html(mapreduce version)
>> On 23 April 2013 17:01, Sripad Sriram <[EMAIL PROTECTED]> wrote:
>>> Hey folks,
>>> Aware that I can use Pig, Hive, etc to join avro files together, but I
>>> have several use cases where I need to perform a reduce-side join on two
>>> avro files. MultipleInputs doesn't seem to like AvroInputFormat - any