简体   繁体   中英

How to get only the “value” field from a scan result in HBase?

My target is to get the value field only from the results of scan of a table. For example I have created the below table.

create 'name','data'

And I have fed the values as

put 'name','row1','data:1','Abhisekh'
put 'name','row2','data:2','Abhijeet'

When I do a scan operation like scan 'name' it shows me the result as below:

hbase(main):021:0> scan 'student'

ROW    COLUMN+CELL                                               
row1   column=name:1, timestamp=1410909681040, value=Abhisekh    
row2   column=name:2, timestamp=1410909717689, value=Abhijeet 

I want that it should show me only the value field as below

Abhisekh

Abhijeet

I do not want to get the other values which I don't want. Could you please help me out in getting such a result?

as to my understanding you're using hbase shell.

hbase(main):021:0> scan 'student'

ROW    COLUMN+CELL                                               
row1   column=name:1, timestamp=1410909681040, value=Abhisekh    
row2   column=name:2, timestamp=1410909717689, value=Abhijeet

it is the default output of hbase shell, as hbase shell is a ruby script you'll need to alter the script to get different result, or you can create additional string parsing.

If all you want is to get the value only, i suggest using native (java) hbase api, rest hbase api, or thrift hbase api that offers more functionality

HBase API
HBase Rest
HBase Thrift

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM