public List<T> extractData(ResultScanner results) throws Exception {
        final List<T> rs = new ArrayList<>();
        int rowNum = 0;
        Result lastResult = null;

        for (Result result : results) {
            final T t = this.rowMapper.mapRow(result, rowNum);
            lastResult = result;
            if (t instanceof Collection<?> collection) {
                rowNum += collection.size();
            } else if (t instanceof Map<?, ?> map) {
                rowNum += map.size();
            } else if (t == null) {
                // empty
            } else if (t.getClass().isArray()) {
                rowNum += Array.getLength(t);
            } else {
                rowNum++;
            }
            rs.add(t);
            if (rowNum >= limit) {
                break;
            }
        }

        eventHandler.handleLastResult(lastResult);
        return rs;
    }
Create a new RowMapperResultSetExtractor.

@param rowMapper the RowMapper which creates an object for each row
commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/LimitRowMapperResultsExtractor.java