Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro >> mail # user >> Joining Avro input files in using Java mapreduce


+
Sripad Sriram 2013-04-24, 00:01
+
Martin Kleppmann 2013-04-24, 10:35
+
Sripad Sriram 2013-04-24, 19:02
Copy link to this message
-
Re: Joining Avro input files in using Java mapreduce
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 :)

Martin
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.
>
> thanks,
> Sripad
>
>
> 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)
>>
>> Martin
>>
>>
>> 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
>>> thoughts?
>>>
>>> thanks!
>>> Sripad
>>>
>>
>>
>
+
Sripad Sriram 2013-04-25, 15:26
+
Martin Kleppmann 2013-04-25, 16:05
+
Johannes Schulte 2013-04-26, 20:41
+
Sripad Sriram 2013-04-28, 02:11
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB