Index: src/docbkx/book.xml =================================================================== --- src/docbkx/book.xml (revision 1235100) +++ src/docbkx/book.xml (working copy) @@ -1548,9 +1548,27 @@
ColumnRangeFilter - Use ColumnRangeFilter to get a column 'slice': - i.e. if you have a million columns in a row but you only want to look at columns bbbb-bbbd. + A ColumnRangeFilter is used for efficient + intra-row scanning. ColumnRangeFilter can access columns by prefix just as rows can be accessed with a row prefix. i.e. if you have a million columns in a row but you only want to look at columns bbbb-bbbd. + For example to scan all columns with names that start with "abc" in "row": + +HTable t = ...; +byte[] row = Bytes.toBytes("row"); +byte[] columnPrefix = Bytes.toBytes("abc"); +Scan scan = new Scan(row, row); +Filter f = new ColumnRangeFilter(columnPrefix, true, columnPrefix, false); +scan.setFilter(f); +scan.setBatching(10); // if potentially many columns could be returned, set this to a reasonably low value. +ResultScanner scanner = t.getScanner(scan); +for (Result r = rs.next(); r != null; r = rs.next()) { + for (KeyValue kv : r.raw()) { + // each kv represent a column + } +} +scanner.close(); + + Note: Introduced in HBase 0.92