can I query hbase to get all rows which row-key start with some string
something like scan 'Table_Name' 'ram%'
I want to get all rows that row-key starts with ram.
You can try using PrefixFilter
to get rowkey's matching a specified prefix
hbase> scan 'TABLE_NAME', { FILTER => "PrefixFilter('ram')"}
Above statement in hbase shell will give you all the rowkey's that start with 'ram'.
From Java API you try this:
byte[] prefix=Bytes.toBytes("ram");
Scan scan = new Scan(prefix));
PrefixFilter prefixFilter = new PrefixFilter(prefix);
scan.addFilter(prefixFilter);
ResultScanner resultScanner = table.getScanner(scan);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.