For example, rowkey is designed as aabbbbcccc, the bbbb part is the specific part which is used to index the record. How can I search HBase table with the bbbb part?
You can use the RowFilter with the SubstringComparator on Scan object to fetch matching records. Note this will require a full scan of all the data.
Scan scan = new Scan();
scan.setFilter(new RowFilter(CompareOp.EQUAL, new SubstringComparator("bbbb")));
scan.addFamily(Bytes.toBytes("columnFamily"));
ResultScanner scanner = 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.