You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Dave Latham (JIRA)" <ji...@apache.org> on 2009/12/10 05:17:18 UTC

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

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
            Priority: Minor
             Fix For: 0.20.3, 0.21.0


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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack reassigned HBASE-2035:
----------------------------

    Assignee: stack

> 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
>
>
> 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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795501#action_12795501 ] 

stack commented on HBASE-2035:
------------------------------

Any byte that is > 0x79 does the weird octal 3-byte thingy.  Looking at outputing using hbase's Bytes.toStringBinary....

> 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
>
>
> 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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794958#action_12794958 ] 

stack commented on HBASE-2035:
------------------------------

I've seen this.  Its annoying and presents difficultly working binary keys.

> 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
>            Priority: Minor
>             Fix For: 0.20.3, 0.21.0
>
>
> 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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Attachment: 2035-0.20.patch

Patch is different for branch.   Problem is made worse by the makeColumnName ruby method.

> 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-0.20.patch, 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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack resolved HBASE-2035.
--------------------------

    Resolution: Fixed

Committed branch and trunk.

> 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-0.20.patch, 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.