aliyun-tablestore-java-sdk icon indicating copy to clipboard operation
aliyun-tablestore-java-sdk copied to clipboard

TimestreamMetaIterator分页会取出所有数据

Open hunanxinhua opened this issue 4 years ago • 0 comments

参考该地址实现:https://help.aliyun.com/document_detail/114347.html?spm=a2c4g.11186623.6.615.17132345T3bKeQ

TimestreamMetaIterator iter1 = db.metaTable()
                .filter(filter)
                .identifierOnly()       // 只返回identifer
                .fetchAll();
        System.out.print(iterator.getTotalCount());   //获取命中的时间线条数
        while (iter1.hasNext()) {
            System.out.print(iterator.next().toString());
        }
    public boolean hasNext() {
        if (isBufferHasData()) {
            return true;
        }
        byte[] token = response.getNextToken();

        while (token != null) {
            request.getSearchQuery().setToken(response.getNextToken());
            request.getSearchQuery().setOffset(0);
            fetchData(request);
            if (isBufferHasData()) {
                return true;
            }
            token = response.getNextToken();
        }
        return false;
    }

上述实现会取出所有数据,是否需要把isBufferHasData提出公共方法出来。目前实现分页,不能用这个方法,只能自己写实现

hunanxinhua avatar Jul 09 '21 02:07 hunanxinhua