hbase shell command - scan and Filter

Nimisha picture Nimisha · Aug 20, 2014 · Viewed 12.3k times · Source

I am pretty new to Hadoop and hbase. Can anybody help me with the scan and filter command.

I was trying to pull the records in hbase for a range of rows and for a particular drug, using Filter. When I am giving this shell command: scan 'Mytable', {COLUMNS => ['abc'], FILTER => "avil",STARTROW => "1100",STOPROW => "1121"}

It is showing me an error as: Incorrect Filter String

I am trying to use this command as a reference:

 hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}

can somebody please help me explain what is Prefixfilter and QualifierFilter?

Answer

Nimisha picture Nimisha · Aug 21, 2014

I've gone through some basics of Filter and scan shell commands in hbase and found that SingleColumnValueFilter is perfect for filter cells based on value. Below command worked for me:

scan 'Mytable', {COLUMNS => ['abc'], FILTER => "SingleColumnValueFilter('abc','drug',=,'binary:avil')",STARTROW => "1100", ENDROW => "1121"}