Hi Jason, Could be that the int is converting to a string as a non-printable character? Did you convert it originally using Bytes.toBytes(int)? You could use either Bytes.toInt() or Bytes.toStringBinary() to get either the original int or a stringified representation.
Gary On Mon, Mar 14, 2011 at 7:08 PM, Jason Rutherglen < [email protected]> wrote: > 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 <[email protected]> > 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 > > >
