Does anybody know how to scan records based on some scan filter i.e.:
column:something = "somevalue"
Something like this, but from HBase shell?
Does anybody know how to scan records based on some scan filter i.e.:
column:something = "somevalue"
Something like this, but from HBase shell?
Use the FILTER param of
scan
, as shown in the usage help:One of the filter is Valuefilter which can be used to filter all column values.
hbase(main):067:0> scan 'dummytable', {FILTER => "ValueFilter(=,'binary:2016-01-26')"}
binary is one of the comparators used within the filter. You can use different comparators within the filter based on what you want to do.
You can refer following url: http://www.hadooptpoint.com/filters-in-hbase-shell/. It provides good examples on how to use different filters in HBase Shell.
More information can be found here. Note that multiple examples reside in the attached
Filter Language.docx
file.Try this. It's kind of ugly, but it works for me.
The HBase shell will include whatever you have in ~/.irbrc, so you can put something like this in there (I'm no Ruby expert, improvements are welcome):
and then you can just say in the shell:
Add setFilterIfMissing(true) at the end of query