Index: src/docbkx/book.xml =================================================================== --- src/docbkx/book.xml (revision 1236040) +++ src/docbkx/book.xml (working copy) @@ -1548,9 +1548,37 @@
ColumnRangeFilter - Use ColumnRangeFilter to get a column 'slice': + A ColumnRangeFilter allows efficient intra row scanning. + + ColumnRangeFilter filter avoids scanning through all columns of the a row but instead seeks ahead to the first matching column for each involved column family. + + Use a 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. + + Note that ColumnRangeFilter does not distinguish columns between column families. If two families have the same matching columns they will all be included in the result. + + Example: Find all columns in a row that start with "abc" + +HTableInterface t = ...; +byte[] row = ...; +byte[] family = ...; +byte[] startColumn = Bytes.toBytes("abc"); +byte[] endColumn = Bytes.toBytes("abd"); +Scan scan = new Scan(row, row); +scan.addFamily(family); // limit to one family +Filter f = new ColumnRangeFilter(startColumn, true, endColumn, false); +scan.setFilter(f); +scan.setBatch(10); // set this if there could be many columns returned +ResultScanner rs = t.getScanner(scan); +for (Result r = rs.next(); r != null; r = rs.next()) { + for (KeyValue kv : r.raw()) { + // each kv presents a column + } +} +rs.close(); + + Note: Introduced in HBase 0.92