hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Rutherglen <jason.rutherg...@gmail.com>
Subject Re: Getting the row with a Coprocessor
Date Tue, 15 Mar 2011 02:08:29 GMT
Gary,

Thanks, the example works.

The next part is the row is not showing up in the KV, from the postPut
method familyMap.

row = kv.getRow();
String rowStr = Bytes.toString(row);

Where rowStr looks like 4 whitespace characters when debugging.  The
row is set in the Put object (as in the code below), eg, it's an int
converted into a byte[].

Jason

On Mon, Mar 14, 2011 at 4:03 PM, Gary Helmling <ghelmling@gmail.com> wrote:
>>
>>
>> HTable table = util.createTable(tableName, families);
>> for (int x=0; x < 20; x++) {
>>  byte[] row = Bytes.toBytes(x);
>>  Put put = new Put(row);
>>  String s = "test hbase lucene";
>>  put.add(headersFam, to, Bytes.toBytes(s));
>>  table.put(put);
>> }
>>
> ...
>
>> Maybe I need to set the Coprocessor on the table then.
>>
>>
> So to load the cp from a table, you could do something like:
>
> HTableDescriptor desc = new HTableDescriptor(tableName);
> for (String fam : families) {
>     desc.addFamily(new HColumnDescriptor(fam));
> }
> desc.setValue("COPROCESSOR$1",
>    String.format("/:%s:USER", LuceneCoprocessor.class.getName()));
>
> HBaseAdmin admin = util.getHBaseAdmin();
> admin.createTable(desc);
> HTable table = new HTable(util.getConfiguration(), tableName);
>
>
> Then carry on with the puts, etc.  And see how that works out.  That should
> limit the coprocessor to only load on your table.
>
> Let me know if you run into problems with this.
>
> Thanks,
> Gary
>

Mime
View raw message