hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stack <st...@duboce.net>
Subject Re: Type mismatch
Date Fri, 04 Feb 2011 05:52:46 GMT
Look at the stack trace.  See where its being thrown.  Look at that
src code at that line offset.  Should give you a clue.
St.Ack

On Thu, Feb 3, 2011 at 9:36 PM, Mark Kerzner <markkerzner@gmail.com> wrote:
> Thank you, that helped, but now I get this error on trying to write back to
> HBase:
>
> java.io.IOException: Pass a Delete or a Put
>
> Here is a fragment on my code. Again, thanks a bunch!
>
>    public static class RowCounterReducer
>            extends TableReducer <Text, IntWritable, Put>
>    {
>        public void reduce(Text key,
>                Iterable<IntWritable> values,
>                Reducer.Context context)
>                throws IOException,
>                InterruptedException {
>            Iterator <IntWritable> iterator = values.iterator();
>            while (iterator.hasNext()) {
>                IntWritable value = iterator.next();
>                Put put = new Put();
>                context.write(key, put);
>            }
>        }
>    }
>
>
> On Thu, Feb 3, 2011 at 2:50 PM, Stack <stack@duboce.net> wrote:
>
>> You are emitting a Text type.  Try just passing 'row' to the context,
>> the one passed in to your map.
>> St.Ack
>>
>> On Thu, Feb 3, 2011 at 12:23 PM, Mark Kerzner <markkerzner@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I have this code to read and write to HBase from MR, and it works fine
>> with
>> > 0 reducers, but it gives a type mismatch error when with 1 reducer. What
>> > should I look at? *Thank you!*
>> >
>> > *Code:*
>> >
>> >    static class RowCounterMapper
>> >            extends TableMapper<Text, IntWritable> {
>> >
>> >        private static enum Counters {
>> >
>> >            ROWS
>> >        }
>> >
>> >        @Override
>> >        public void map(ImmutableBytesWritable row, Result values, Context
>> > context)
>> >                throws IOException, InterruptedException {
>> >            for (KeyValue value : values.list()) {
>> >                if (value.getValue().length > 0) {
>> >                    Text key = new Text(value.getValue());
>> >                    context.write(key, ONE);
>> >                }
>> >            }
>> >        }
>> >    }
>> >
>> > *Error: *
>> >
>> > java.io.IOException: Type mismatch in key from map: expected
>> > org.apache.hadoop.hbase.io.ImmutableBytesWritable, recieved
>> > org.apache.hadoop.io.Text
>> >
>>
>

Mime
View raw message