You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Elliot Miller (Jira)" <ji...@apache.org> on 2020/07/28 14:57:00 UTC

[jira] [Commented] (HBASE-11676) Scan FORMATTER is not applied for columns using non-printable name in shell

    [ https://issues.apache.org/jira/browse/HBASE-11676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17166481#comment-17166481 ] 

Elliot Miller commented on HBASE-11676:
---------------------------------------

The root cause of this issue is how we map from column names (ie. {{"family:qualifier"}}) to converter (ie. {{"toLong"}}). We have been using {{String.from_java_bytes}} to format the column name when storing a converter and the *formatted* column name (by default this uses {{org.apache.hadoop.hbase.util.Bytes.toStringBinary}}) when retrieving a converter from the mapping.

Incidentally, this means that _you can work around the issue_ by setting the column name formatter to {{toString}} rather than {{toStringBinary}}. Note that the value is correctly printed as a long. The caveat is that the column qualifier will not be visible (since toString drops non-printable characters). Example:

{code:ruby}
hbase(main):007:0> create 'test1', 'f'
Created table test1
Took 0.7032 seconds
=> Hbase::Table - test1
hbase(main):008:0> incr 'test1', 'row1', "f:\x11", 1
COUNTER VALUE = 1
Took 0.0418 seconds
hbase(main):009:0> scan 'test1', FORMATTER => 'toString', COLUMNS => ["f:\x11:toLong"]
ROW                                        COLUMN+CELL
 row1                                      column=f:, timestamp=2020-07-28T14:46:39.052Z, value=1
1 row(s)
Took 0.0040 seconds
{code}

This issue is also present in the {{get}} command, so I will fix that as well. Example:


{code:ruby}
hbase(main):018:0> get 'test1', 'row1', COLUMNS => "f:\x11:toLong"
COLUMN                                     CELL
 f:\x11                                    timestamp=2020-07-28T14:46:39.052Z, value=\x00\x00\x00\x00\x00\x00\x00\x01
1 row(s)
Took 0.0036 seconds
{code}


The fix is to use the same method for retrieval that is used when storing the mapping from column name to converter (ie. {{String.from_java_bytes}}).

*I will be putting up a patch for this shortly.*

> Scan FORMATTER is not applied for columns using non-printable name in shell 
> ----------------------------------------------------------------------------
>
>                 Key: HBASE-11676
>                 URL: https://issues.apache.org/jira/browse/HBASE-11676
>             Project: HBase
>          Issue Type: Bug
>          Components: shell
>         Environment: 0.98 + hadoop2.2.0
>            Reporter: t samkawa
>            Assignee: Elliot Miller
>            Priority: Minor
>
> The "FORMATTER" does not work if the target cell`s column uses binary name.
>  hbase> create "test1", "f"
>  hbase> incr "test1", "row1" , "f:a", 1
>  hbase> incr "test1", "row1" , "f:\x11", 1
>  hbase> scan "test1", COLUMNS=>["f:\x11:toLong","f:a:toLong"]
> ROW   COLUMN+CELL
>  row1    column=f:\x11, ..., value=\x00\x00\x00\x00\x00\x00\x00\x01
>  row1    column=f:a, ..., value=1



--
This message was sent by Atlassian Jira
(v8.3.4#803005)