HTableInterface hTable = services.getTable(tableRef.getTable().getPhysicalName().getBytes());
try {
byte[] minKey = null, maxKey = null;
// Do a key-only scan to get the first row of a table. This is the min
// key for the table.
Scan scan = new Scan(HConstants.EMPTY_START_ROW, new KeyOnlyFilter());
ResultScanner scanner = hTable.getScanner(scan);
try {
Result r = scanner.next();
if (r != null) {
minKey = r.getRow();
}
} finally {
scanner.close();
}
// Get max possible key value
scan = new Scan();
scan.setFilter(new KeyOnlyFilter());
scan.setReversed(true);
scanner = hTable.getScanner(scan);
try {
Result r = scanner.next();
if (r != null) {