我已将 byte[] 作为 rowKey 放在 HBase 表中。现在我希望能够根据我使用的字节检索行。如果我使用 HBase shell,我会执行以下操作:
get 'table', "\x12\x00\x00\x00\x03\x03" and it works fine.
现在,我想在使用其余客户端的 Java 类 GetMyRow.java 中获取该行。我的代码如下所示:
byte[] rowKey = new byte[6];
rowKey[0] = 0x12;
rowKey[1] = 0x00;
rowKey[2] = 0x00;
rowKey[3] = 0x00;
rowKey[4] = 0x03;
rowKey[5] = 0x03;
Get g = new Get(rowKey);
Result r = table.get(g);
我收到以下错误:
org.apache.commons.httpclient.URIException: escaped absolute path not valid
at org.apache.commons.httpclient.URI.setRawPath(URI.java:2837)
at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2023)
at org.apache.commons.httpclient.URI.<init>(URI.java:167)
at org.apache.hadoop.hbase.rest.client.Client.executePathOnly(Client.java:115)
at org.apache.hadoop.hbase.rest.client.Client.execute(Client.java:164)
at org.apache.hadoop.hbase.rest.client.Client.get(Client.java:284)
at org.apache.hadoop.hbase.rest.client.Client.get(Client.java:257)
at org.apache.hadoop.hbase.rest.client.Client.get(Client.java:242)
at org.apache.hadoop.hbase.rest.client.RemoteHTable.get(RemoteHTable.java:267)
at udf.HBaseConnector.main(GetMyRow.java:74)
任何想法如何根据构成 rowKey 的字节获取一行?