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

Manaswini edited comment on HBASE-13788 at 3/23/17 1:49 AM:
------------------------------------------------------------

As per the @Stack suggestion, I've added an ordinal option. i.e. FORMATTER just 
listed conversion per column mentioned in COLUMN? i.e. FORMATTER => {'toInt'}

Now the custom formatting can be specified in two ways:

 1. Specifying it for each column by column qualifier
 2. Without the column qualifier in which case the column qualifier will be 
derived from COLUMNS specification and applied in the order they appear in 
COLUMNS specification.

Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
 
 hbase> scan 't1', {COLUMN => ['cf:qualifier1','cf:qualifier2'],
  FORMATTER => {'cf:qualifier1'=> 'toInt','cf:qualifier2'=> 
'c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
   
  or
 
 hbase> scan 't1', {COLUMN => ['cf:qualifier1','cf:qualifier2'],
 FORMATTER => [ 'toInt','c(org.apache.hadoop.hbase.util.Bytes).toInt']

stack - I've attached the patch and the test cases I have it tested for. Could 
you review and let me know if any improvements are needed? 


Thanks!
Mansi 




was (Author: mmaharana):
As per the @Stack suggestion, I've added an ordinal option. i.e. FORMATTER just 
listed conversion per column mentioned in COLUMN? i.e. FORMATTER => {'toInt'}. 

Now the custom formatting can be specified in two ways:

 1. Specifying it for each column by column qualifier
 2. Without the column qualifier in which case the column qualifier will be 
derived from COLUMNS specification and applied in the order they appear in 
COLUMNS specification.

Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
 
 hbase> scan 't1', {COLUMN => ['cf:qualifier1','cf:qualifier2'],
  FORMATTER => {'cf:qualifier1'=> 'toInt','cf:qualifier2'=> 
'c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
   
  or
 
 hbase> scan 't1', {COLUMN => ['cf:qualifier1','cf:qualifier2'],
 FORMATTER => [ 'toInt','c(org.apache.hadoop.hbase.util.Bytes).toInt']

stack - I've attached the patch and the test cases I have it tested for. Could 
you review and let me know if any improvements are needed? 


Thanks!
Mansi 



> Shell commands do not support column qualifiers containing colon (:)
> --------------------------------------------------------------------
>
>                 Key: HBASE-13788
>                 URL: https://issues.apache.org/jira/browse/HBASE-13788
>             Project: HBase
>          Issue Type: Bug
>          Components: shell
>    Affects Versions: 0.98.0, 0.96.0, 1.0.0, 1.1.0
>            Reporter: Dave Latham
>            Assignee: Manaswini
>         Attachments: Hbase-13788-testcases.docx, hbase-13788-v1.patch
>
>
> The shell interprets the colon within the qualifier as a delimiter to a 
> FORMATTER instead of part of the qualifier itself.
> Example from the mailing list:
> Hmph, I may have spoken too soon. I know I tested this at one point and
> it worked, but now I'm getting different results:
> On the new cluster, I created a duplicate test table:
> hbase(main):043:0> create 'content3', {NAME => 'x', BLOOMFILTER =>
> 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION =>
> 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536',
> IN_MEMORY => 'false', BLOCKCACHE => 'true'}
> Then I pull some data from the imported table:
> hbase(main):045:0> scan 'content', {LIMIT=>1,
> STARTROW=>'A:9223370612089311807:twtr:57013379'}
> ROW                                  COLUMN+CELL
> ....
> A:9223370612089311807:twtr:570133798827921408
> column=x:twitter:username, timestamp=1424775595345, value=BERITA &
> INFORMASI!
> Then put it:
> hbase(main):046:0> put
> 'content3','A:9223370612089311807:twtr:570133798827921408',
> 'x:twitter:username', 'BERITA & INFORMASI!'
> But then when I query it, I see that I've lost the column qualifier
> ":username":
> hbase(main):046:0> scan 'content3'
> ROW                                  COLUMN+CELL
>  A:9223370612089311807:twtr:570133798827921408 column=x:twitter,
>  timestamp=1432745301788, value=BERITA & INFORMASI!
> Even though I'm missing one of the qualifiers, I can at least filter on
> columns in this sample table.



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

Reply via email to