Scan s = new Scan();
s.addFamily(Bytes.toBytes("cf1"));
s.setCaching(cacheRows);
s.setCacheBlocks(false);
s.setStartRow("30.0.2.2\01441756800\0");
s.setStopRow("30.0.2.3\01441756800\0");
ResultScanner scanner = table.getScanner(s);
long rows = 0;
try {
for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
rows++;
}
} finally {
scanner.close();
}
System.out.println("Total no of rows = " + rows);
Run Code Online (Sandbox Code Playgroud)
当我使用 cacheRows = 100 或 10000 运行上面的代码时,它会打印 Total no of rows = 480000
当我使用 cacheRows = 100000 运行上面的代码时,它会打印 Total no of rows = 10090
cacheRows = 10083 打印 480000
cacheRows = 10084 打印 …
hbase ×1