Abhisekh
Abhisekh

Reputation: 151

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?

Upvotes: 0

Views: 735

Answers (1)

Averman
Averman

Reputation: 441

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

Upvotes: 0

Related Questions