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

Josh Elser commented on HBASE-18067:
------------------------------------

A quick summary of what this changes:

{noformat}
text = '⻆⻇'
"\342\273\206\342\273\207"
row = '⻄'
"\342\273\204"
family = 'ㄹ'
"\343\204\271"
qualifier = '⻅'
"\342\273\205"

create 'foo', 'f1'
Created table foo
Took 0.2350 seconds
put 'foo', 'r1', 'f1:a', text
Took 0.1200 seconds
scan 'foo'
ROW                                           COLUMN+CELL
 r1                                           column=f1:a, 
timestamp=1495134339066, value=\xE2\xBB\x86\xE2\xBB\x87
1 row(s)
Took 0.0160 seconds
scan 'foo', {FORMATTER=>'toString'}
ROW                                           COLUMN+CELL
 r1                                           column=f1:a, 
timestamp=1495134339066, value=⻆⻇
1 row(s)
Took 0.0060 seconds
get 'foo', 'r1'
COLUMN                                        CELL
 f1:a                                         timestamp=1495134339066, 
value=\xE2\xBB\x86\xE2\xBB\x87
1 row(s)
Took 0.0050 seconds
get 'foo', 'r1', {FORMATTER=>'toString'}
COLUMN                                        CELL
 f1:a                                         timestamp=1495134339066, value=⻆⻇
1 row(s)
Took 0.0030 seconds

create 'bar', family
Created table bar
Took 0.4210 seconds
put 'bar', row, "#{family}:#{qualifier}", text
Took 0.0080 seconds
scan 'bar'
ROW                                           COLUMN+CELL
 \xE2\xBB\x84                                 column=\xE3\x84\xB9:\xE2\xBB\x85, 
timestamp=1495134339575, value=\xE2\xBB\x86\xE2\xBB\x87
1 row(s)
Took 0.0030 seconds
scan 'bar', {FORMATTER=>'toString'}
ROW                                           COLUMN+CELL
 ⻄                                          column=ㄹ:⻅, 
timestamp=1495134339575, value=⻆⻇
1 row(s)
Took 0.0050 seconds
get 'bar', row
COLUMN                                        CELL
 \xE3\x84\xB9:\xE2\xBB\x85                    timestamp=1495134339575, 
value=\xE2\xBB\x86\xE2\xBB\x87
1 row(s)
Took 0.0050 seconds
get 'bar', row, {FORMATTER=>'toString'}
COLUMN                                        CELL
 ㄹ:⻅                                      timestamp=1495134339575, value=⻆⻇
1 row(s)
Took 0.0050 seconds
{noformat}

If anyone was wondering, I just picked some characters off a utf-8 character 
list :)

> Support a default converter for data read shell commands
> --------------------------------------------------------
>
>                 Key: HBASE-18067
>                 URL: https://issues.apache.org/jira/browse/HBASE-18067
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Josh Elser
>            Assignee: Josh Elser
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-18067.001.patch
>
>
> The {{get}} and {{scan}} shell commands have the ability to specify some 
> complicated syntax on how to encode the bytes read from HBase on a per-column 
> basis. By default, bytes falling outside of a limited range of ASCII are just 
> printed as hex.
> It seems like the intent of these converts was to support conversion of 
> certain numeric columns as a readable string (e.g. 1234).
> However, if non-ascii encoded bytes are stored in the table (e.g. UTF-8 
> encoded bytes), we may want to treat all data we read as UTF-8 instead (e.g. 
> if row+column+value are in Chinese). It would be onerous to require users to 
> enumerate every column they're reading to parse as UTF-8 instead of the 
> limited ascii range. We can provide an option to encode all values retrieved 
> by the command.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to