Aashu
Aashu

Reputation: 1287

Scan table with multiple rowkey filter in hbase

I have tried with single row-key ,its working fine but i am unable to fetch multiple row-key scan.

scan 'LPV',{FILTER =>"(PrefixFilter('174','194')"}

getting error,find Filter to support scan multiple row key ranges but didnt find is it possible or not ? I want to fetch multiple records based on multiple row-keys. Any help,Thanks.

Upvotes: 0

Views: 9667

Answers (2)

Arnon Rotem-Gal-Oz
Arnon Rotem-Gal-Oz

Reputation: 25909

You just need to OR two PrefixFilters as in

scan 'LPV',{FILTER =>"(PrefixFilter('174') OR PrefixFilter('194')"}

Upvotes: 4

ozhang
ozhang

Reputation: 171

I am not sure there is a solution in Hbase shell for multiple prefix filter. But you can write a script to do multiple prefixfilter one by one. for example put your key prefixes to a file a1.txt line by line;

a1.txt
-------
pref1
pref2
pref3

then run a script like (i am not good at shell scripting. you can do better)

cat a1.txt | while read LINE; do echo "scan 'LPV',{FILTER=>\"PrefixFilter('$LINE')\"} " | hbase shell;done

Upvotes: 0

Related Questions