Description
Binary values in the shell don't seem to be formatted correctly. For example:
hbase(main):007:0> put 't1', 'r1', 'f1:q1', "\x91", 1000 0 row(s) in 0.0160 seconds hbase(main):008:0> scan 't1' ROW COLUMN+CELL r1 column=f1:q1, timestamp=1260417826655, value=\357\277\275 1 row(s) in 0.1090 seconds
In this case we insert a single byte (double quotes needed for it to interpret the hex value correctly), but when formatted, it appears as 3 bytes in octal.
The same thing happens when the data is inserted via the Java api. For example, this code:
HTableDescriptor tableDesc = new HTableDescriptor("t2"); tableDesc.addFamily(new HColumnDescriptor("f1")); HBaseAdmin admin = new HBaseAdmin(new HBaseConfiguration()); admin.createTable(tableDesc); HTable table = new HTable("t2"); Put put = new Put(Bytes.toBytes("r1")); put.add(Bytes.toBytes("f1"), Bytes.toBytes("q1"), new byte[] {(byte) 0x91}); table.put(put); Result result = table.get(new Get(Bytes.toBytes("r1"))); System.out.println(Bytes.toStringBinary(result.raw()[0].getValue()));
Prints out \x91
And then accessing via shell gives:
hbase(main):009:0> scan 't2'
ROW COLUMN+CELL
r1 column=f1:q1, timestamp=1260418531959, value=\357\277\275
1 row(s) in 0.1100 seconds
Attachments
Attachments
Issue Links
- is related to
-
HBASE-1611 Have shell output binary hex-encoded rather than octal-encoded
- Closed