Monday, August 12, 2013

Hbase - Page limit


@For a paging like [Select * from aTable limit 10]

// HbaseDao.java
    public ResultScanner resultScanner(String tableName, int intPages) throws Exception {

        // Get a object from Pool
        HTableInterface hTable =  htablePool.getTable(tableName);

        long pageSize = intPages;
        Filter filter = new PageFilter(pageSize);
        Scan s =new Scan();
        s.setFilter(filter);

        ResultScanner rs = hTable.getScanner(s);

        return rs;
    }

No comments:

Post a Comment