hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niels Basjes <Ni...@basjes.nl>
Subject Scanning for a rowkey prefix.
Date Tue, 16 Sep 2014 08:16:14 GMT

I found that in several scenarios where I use HBase I need to scan for a
specific rowkey prefix.
(The prefix filter is too inefficient in my scenarios because it scans all
rows and filters them)

The way I do that is by using the scan.setStartRow and the scan.setStopRow
But because these stoprow must be 'one bigger'  I created a utility method
for my own projects looks like this:

  private void scanForPrefix(Scan scan, byte[] prefix) {
    // Start the scan with the exact prefix

    // Stop at the end of this prefix (= this prefix +1)
    byte[] endOfScan = prefix.clone();

Would it make sense to add this method the Scan class so you can simply say


I you think this would make sense then I'll create a Jira ticket and submit
a patch.

Best regards

Niels Basjes

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message