I'm tryed this way
public static class Reduce extends Reducer<IntWritable, Text,
ImmutableBytesWritable, List<Put>> {
and in the main
TableMapReduceUtil.initTableReducerJob(inputTableName, null, job);
instead of
TableMapReduceUtil.initTableReducerJob(inputTableName, Reduce.class,
job);
In fact, now is a Reduce Clas not a tableReducer, but i have the same error
Error: java.lang.ClassCastException: java.util.ArrayList cannot be cast to
org.apache.hadoop.hbase.client.Mutation
2015-05-19 15:14 GMT+02:00 Shahab Yunus <[email protected]>:
> The error is highlighting the issue.
>
> You can't output List of Puts like this. Your reducer output is Mutation
> and NOT a list of Mutation.
>
> I have handled this scenario by defining my own base abstract class:
>
>
> *public* *abstract* *class* TableReducerBatchPuts<KEYIN, VALUEIN, KEYOUT>
> *extends* Reducer<KEYIN, VALUEIN, KEYOUT, List<Put>> {
> ...
> And then using this to implement by reducer by extending this. You can do
> something similar, perhaps?
>
> Regards,
> Shahab
>
> On Tue, May 19, 2015 at 9:05 AM, Silvio Di gregorio <
> [email protected]> wrote:
>
> > Hi
> > I'm trying to emit, on reduce phase, a list of puts
> >
> > *context.write(null , puts);*
> >
> > puts is
> >
> > *List<Put> puts=new ArrayList<Put>();*
> >
> > and the Reduce signature is:
> >
> > *public static class Reduce extends TableReducer<IntWritable, Text,
> > ImmutableBytesWritable>{*
> >
> > this is the error
> >
> > *The method write(ImmutableBytesWritable, Mutation) in the type
> > TaskInputOutputContext<IntWritable,Text,ImmutableBytesWritable,Mutation>
> is
> > not applicable for the arguments (null, List<Put>)*
> >
> > thanks
> > silvio
> >
>