You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "stack (JIRA)" <ji...@apache.org> on 2010/01/07 03:24:54 UTC

[jira] Updated: (HBASE-2035) Binary values are formatted wrong in shell

     [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack updated HBASE-2035:
-------------------------

    Attachment: 2035.patch

Patch that makes the shell do binary as hex.  I tried Dave's combos above and it seems to do right thing.  I'll just commit.

> Binary values are formatted wrong in shell
> ------------------------------------------
>
>                 Key: HBASE-2035
>                 URL: https://issues.apache.org/jira/browse/HBASE-2035
>             Project: Hadoop HBase
>          Issue Type: Bug
>    Affects Versions: 0.20.2
>            Reporter: Dave Latham
>            Assignee: stack
>            Priority: Minor
>             Fix For: 0.20.3, 0.21.0
>
>         Attachments: 2035.patch
>
>
> Binary values in the shell don't seem to be formatted correctly.  For example:
> {code}
> 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
> {code}
> 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:
> {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()));
> {code}
> Prints out {{\x91}}
> And then accessing via shell gives:
> {code}
> 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
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.