You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by Marko Dinic <ha...@gmail.com> on 2016/03/29 09:17:28 UTC

Use ChainMapper with TableMapReduceUtil

Is it possible to chain multiple mappers when the first mapper in the chain
reads from a HBase table? That is, to use ChainMapper with
TableMapReduceUtil?

I'm trying to perform some transformations on each record retrieved from
the HBase, but I'm not able to make it work.

Here's a code snipped where are try to use the two:

    Job job = new Job(hBaseConfig, "Retrieving data from HBase");
    job.setJarByClass(DataRetrievalDriver.class);

    Scan scan = scanCreator.getScan();

    TableMapReduceUtil.initTableMapperJob(
            table,
            scan,
            DataRetrievalMapper.class,
            Text.class,
            ElementWritable.class,
            job,
            true,
            SaltTableInputFormat.class
    );

    ChainMapper.addMapper(job, TransformMapper.class, Text.class,
ElementWritable.class, Text.class, ElementWritable.class, new
Configuration());

    SequenceFileOutputFormat.setOutputPath(job, new Path("out"));

    job.setReducerClass(Reducer.class);
    job.setNumReduceTasks(1);

    job.waitForCompletion(true);

But for some reason this doesn't work.

Any help is highly appreciated.

Best regards,

-- 
Marko Dinic