Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scan HTable rows for specific column value using HBase shell

Tags:

nosql

hbase

I want to scan rows in a HTable from hbase shell where a column family (i.e., Tweet) has a particular value (i.e., user_id).

Now I want to find all rows where tweet:user_id has value test1 as this column has value 'test1'

column=tweet:user_id, timestamp=1339581201187, value=test1 

Though I can scan table for a particular using,

scan 'tweetsTable',{COLUMNS => 'tweet:user_id'} 

but I did not find any way to scan a row for a value.

Is it possible to do this via HBase Shell?

I checked this question as well.

like image 473
Nishu Tayal Avatar asked Jun 13 '12 10:06

Nishu Tayal


People also ask

What is scan in HBase?

Scaning using HBase Shell The scan command is used to view the data in HTable. Using the scan command, you can get the table data. Its syntax is as follows: scan '<table name>'


1 Answers

It is possible without Hive:

scan 'filemetadata',       { COLUMNS => 'colFam:colQualifier',         LIMIT => 10,         FILTER => "ValueFilter( =, 'binaryprefix:<someValue.e.g. test1 AsDefinedInQuestion>' )"       } 

Note: in order to find all rows that contain test1 as value as specified in the question, use binaryprefix:test1 in the filter (see this answer for more examples)

like image 50
stu s Avatar answered Oct 07 '22 10:10

stu s