Strings in hbase shell?

I use

scan 'table_name', { COLUMNS => 'column_family:column_qualifier', LIMIT => 2 } 

to list 2 rows in the hbase table, but I would like to know if the following use of the hbase shell can be achieved:

Questions

  • list all string keys through hbase shell?
  • Specify only those lines that have a specific word in the lines?
+8
hbase
source share
3 answers

A1. hbase(main):015:0> count 'table_name', INTERVAL => 1

A2. Use a RowKey filter with SubstringComparator .

Using:

 hbase(main):003:0> import org.apache.hadoop.hbase.filter.CompareFilter hbase(main):005:0> import org.apache.hadoop.hbase.filter.SubstringComparator hbase(main):006:0> scan 'test', {FILTER => org.apache.hadoop.hbase.filter.RowFilter.new(CompareFilter::CompareOp.valueOf('EQUAL'),SubstringComparator.new("word_by_which_you_want_to_search"))} 
+26
source share

KeyOnlyFilter - does not accept arguments. Returns the key part of each key-value pair.

Syntax: KeyOnlyFilter ()

+3
source share

Early decision:

 scan 'test', { COLUMNS => ['col_family_name:col_name'], FILTER => "RowFilter(=, 'substring:the_string_to_be_compared')" } 
+1
source share

All Articles