Search in sources :

Example 1 with SizedCellScanner

use of org.apache.hadoop.hbase.io.SizedCellScanner in project hbase by apache.

the class TestCellBlockBuilder method getSizedCellScanner.

static CellScanner getSizedCellScanner(final Cell[] cells) {
    int size = -1;
    for (Cell cell : cells) {
        size += PrivateCellUtil.estimatedSerializedSizeOf(cell);
    }
    final int totalSize = ClassSize.align(size);
    final CellScanner cellScanner = CellUtil.createCellScanner(cells);
    return new SizedCellScanner() {

        @Override
        public long heapSize() {
            return totalSize;
        }

        @Override
        public Cell current() {
            return cellScanner.current();
        }

        @Override
        public boolean advance() throws IOException {
            return cellScanner.advance();
        }
    };
}
Also used : SizedCellScanner(org.apache.hadoop.hbase.io.SizedCellScanner) Cell(org.apache.hadoop.hbase.Cell) CellScanner(org.apache.hadoop.hbase.CellScanner) SizedCellScanner(org.apache.hadoop.hbase.io.SizedCellScanner)

Aggregations

Cell (org.apache.hadoop.hbase.Cell)1 CellScanner (org.apache.hadoop.hbase.CellScanner)1 SizedCellScanner (org.apache.hadoop.hbase.io.SizedCellScanner)1