You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by sriram <rs...@gmail.com> on 2011/08/30 18:21:17 UTC

multiple insert in hbase

After the reducer phase the table.put(put) part insert content twice in the table

1)as actual key value
2)actual key and value as empty string.

Can anyone give me as solution to this issue


Re: multiple insert in hbase

Posted by sriram <rs...@gmail.com>.
This is another erroer shown


tmp.java:595: cannot find symbol
symbol  : method
initTableReducerJob(java.lang.String,java.lang.Class
<org.myorg.WordCount.IntSumReducer>,
org.apache.hadoop.mapreduce.Job)
location: class org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil
TableMapReduceUtil.initTableReducerJob("table", IntSumReducer.class,job);

This error occurs when i tried to put reducer output to hbase table

Any solution???????????????/





Re: multiple insert in hbase

Posted by sriram <rs...@gmail.com>.
Configuration config= context.getConfiguration();
   HTable table = new HTable(config,"index");    

   context.write(key, new Text(toReturn.toString()));
        Enumeration e = temp.keys();
      Put put = new Put(Bytes.toBytes(key.toString()));
         while(e.hasMoreElements())
    {
        String val = e.nextElement().toString();
       
put.add(Bytes.toBytes("file"),Bytes.toBytes(val),
Bytes.toBytes((temp.get(val)).toString()));
       
      break;
    }
   table.put(put);
  table.flushCommits();
table.close();



This is the part of reducer code.I dont know what should i do .


Re: multiple insert in hbase

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Put only one, either the HTable or the output format.

J-D

On Tue, Aug 30, 2011 at 10:56 AM, sriram <rs...@gmail.com> wrote:
> Yes you are right.
> What should i do?????
>
>

Re: multiple insert in hbase

Posted by sriram <rs...@gmail.com>.
Yes you are right.
What should i do?????


Re: multiple insert in hbase

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Well, it doesn't. I mean, AFAIK there's no bug in the code that does
that, so it's probably your code.

Wild guess, maybe you are using your own HTable to put plus you emit a
Put in the reducer?

J-D

On Tue, Aug 30, 2011 at 9:21 AM, sriram <rs...@gmail.com> wrote:
> After the reducer phase the table.put(put) part insert content twice in the table
>
> 1)as actual key value
> 2)actual key and value as empty string.
>
> Can anyone give me as solution to this issue
>
>