hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jothikumar Ekanath <kbmku...@gmail.com>
Subject Re: java.io.IOException: Pass a Delete or a Put
Date Wed, 12 Sep 2012 17:02:24 GMT
Any help on this one please.

On Tue, Sep 11, 2012 at 11:19 AM, Jothikumar Ekanath <kbmkumar@gmail.com>wrote:

> Hi Stack,
>                 Thanks for the reply. I looked at the code and i am having
> a very basic confusion on how to use it correctly.  The code i wrote
> earlier has the following input and output types and i want it that way
>
> After looking at the sources and examples, i modified my reducer (given
> below), the mapper and job configuration are still the same. Still i see
> the same error. Am i doing something wrong?
>
>
>  DailySumMapper extends TableMapper<Text, Text>
>     KEYOUT = Text
>     VALUEOUT = Text
>
>  DailySumReducer extends TableReducer<Text, Text, ImmutableBytesWritable>
>
>     KEYIN = Text
>     VALUEIN = Text
>     KEYOUT = ImmutableBytesWritable
>     VALUEOUT = must be always Put or Delete when we extend TableReducer,
> So we are not specifying that.
>
> Code
>  public static class DailySumReducer extends TableReducer<Text, Text,
> ImmutableBytesWritable> {
>
>         private int count = 0;
>         protected void reduce(Text key, Iterable<Text>
> values,Reducer.Context context) throws IOException, InterruptedException{
>
>             long inbound = 0l;
>             long outbound = 0l;
>             for (Text val : values) {
>                 String text = val.toString();
>                 int index = text.indexOf("-");
>                 String in = text.substring(0,index);
>                 String out = text.substring(index+1,text.length());
>                 inbound = inbound + Long.parseLong(in);
>                 outbound = outbound + Long.parseLong(out);
>             }
>             ByteBuffer data = ByteBuffer.wrap(new byte[16]);
>             data.putLong(inbound);
>             data.putLong(outbound);
>             Put put = new Put(Bytes.toBytes(key.toString()+20120804));
>             put.add(Bytes.toBytes("t"), Bytes.toBytes("s"),data.array());
>             context.setStatus("Emitting Put " + count++);
>             ImmutableBytesWritable ibw = new
> ImmutableBytesWritable(Bytes.toBytes(key.toString()));
>             context.write(ibw,put);
>
>         }
>     }
>
> On Tue, Sep 11, 2012 at 10:38 AM, Stack <stack@duboce.net> wrote:
>
>> On Mon, Sep 10, 2012 at 7:06 PM, Jothikumar Ekanath <kbmkumar@gmail.com>
>> wrote:
>> > Hi,
>> >        Getting this error while using hbase as a sink.
>> >
>> >
>> > Error
>> > java.io.IOException: Pass a Delete or a Put
>>
>> Would suggest you study the mapreduce jobs that ship with hbase both
>> in main and under test.
>>
>> Looking at your program, you are all Text.  The above complaint is
>> about wanting a Put or Delete.  Can you change what you produce so
>> Put/Delete rather than Text?
>>
>> St.Ack
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message