hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siddharth Kumar <s.siddhart...@gmail.com>
Subject Rest Client Access to Hbase
Date Wed, 11 Jan 2012 17:08:48 GMT
Hi,

    I am having trouble using the Rest Client API to query my Hbase
cluster. My row key has spaces in them and that gives me a
"org.apache.commons.httpclient.URIException: escaped absolute path not
valid" in the step where I submit the Get instance to the Result class.
When I removed the spaces in the RowKey it works fine.
    I don't see this issue if I use the Scan instead of Get (with the
spaces in them). I am guessing it is some String formatting thing in the
RemoteHTable class. Below is an example of my code.

            RemoteHTable table = new RemoteHTable(client,"test");

           Scan scan = new Scan();
            scan.setStartRow(Bytes.toBytes("201101:this is start test "));
            scan.setStopRow(Bytes.toBytes("201101:this is stop test "));
            ResultScanner scanner = table.getScanner(scan);
            for (Result res : scanner) {
                for(KeyValue kv : res.raw()){
                        System.out.println("Row:" +
Bytes.toString(kv.getRow()) +"; value: " + Bytes.toString(kv.getValue()));
                }
            }

            String rowKey = "201101:this is start test";
            Get keyGet = new Get(Bytes.toBytes(rowKey));
            System.out.println(keyGet.toString());

            //* This is where the error is*
            Result resGet = table.get(keyGet);
            for(KeyValue kvGet : resGet.raw()){
                System.out.println("Row:" + Bytes.toString(kvGet.getRow())
+"; value: " + Bytes.toString(kvGet.getValue()));
            }


Any ideas here please.

Thanks
Siddharth

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