Package org.apache.hadoop.hbase.client
Class ClientUtil
java.lang.Object
org.apache.hadoop.hbase.client.ClientUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areScanStartRowAndStopRowEqual
(byte[] startRow, byte[] stopRow) static byte[]
calculateTheClosestNextRowKeyForPrefix
(byte[] rowKeyPrefix) When scanning for a prefix the scan should stop immediately after the the last row that has the specified prefix.static Cursor
createCursor
(byte[] row)
-
Constructor Details
-
ClientUtil
public ClientUtil()
-
-
Method Details
-
areScanStartRowAndStopRowEqual
-
createCursor
-
calculateTheClosestNextRowKeyForPrefix
When scanning for a prefix the scan should stop immediately after the the last row that has the specified prefix. This method calculates the closest next rowKey immediately following the given rowKeyPrefix.
IMPORTANT: This converts a rowKeyPrefix into a rowKey.
If the prefix is an 'ASCII' string put into a byte[] then this is easy because you can simply increment the last byte of the array. But if your application uses real binary rowids you may run into the scenario that your prefix is something like:
{ 0x12, 0x23, 0xFF, 0xFF }
Then this stopRow needs to be fed into the actual scan
{ 0x12, 0x24 } (Notice that it is shorter now)
This method calculates the correct stop row value for this usecase.- Parameters:
rowKeyPrefix
- the rowKeyPrefix.- Returns:
- the closest next rowKey immediately following the given rowKeyPrefix.
-