How to read Mahout generated files in Pig
1 answer
I ended up using elephant bird (v2.2.3) like this:
register '/usr/share/dse/mahout/mahout-core-0.6-job.jar';
register './elephant-bird-2.2.3.jar';
%declare SEQFILE_LOADER 'com.twitter.elephantbird.pig.load.SequenceFileLoader';
%declare LONG_CONVERTER 'com.twitter.elephantbird.pig.util.LongWritableConverter';
%declare INT_CONVERTER 'com.twitter.elephantbird.pig.util.IntWritableConverter';
%declare VECTOR_CONVERTER 'com.twitter.elephantbird.pig.mahout.VectorWritableConverter';
%declare TEXT_CONVERTER 'com.twitter.elephantbird.pig.util.TextConverter';
....
sets = LOAD '$INPUT_SETS' USING $SEQFILE_LOADER ( '-c $INT_CONVERTER', '-c $VECTOR_CONVERTER') AS (thing_id:int, recommendations:chararray);
...
+1
source to share