in src/main/java/com/aliyun/odps/jdbc/OdpsScollResultSet.java [305:341]
private void fetchRows() throws SQLException {
// determines the frame id to be cached
cachedUpperRow = (cursorRow / fetchSize) * fetchSize;
// tailor the fetchSize to read effective records
long count = fetchSize;
if (cachedUpperRow + count > totalRows) {
count = totalRows - cachedUpperRow;
}
try {
long start = System.currentTimeMillis();
Record reuseRecord = null;
TunnelRecordReader reader;
if (mode.equals(ResultMode.OFFLINE)) {
reader = sessionHandle.openRecordReader(cachedUpperRow, count, true);
} else {
reader = sessionHandle.openRecordReader(cachedUpperRow, count, -1);
}
for (int i = 0; i < count; i++) {
reuseRecord = reader.read(reuseRecord);
int columns = reuseRecord.getColumnCount();
rowsCache[i] = new Object[columns];
for (int j = 0; j < reuseRecord.getColumnCount(); j++) {
rowsCache[i][j] = reuseRecord.get(j);
}
}
long duration = System.currentTimeMillis() - start;
long totalKBytes = reader.getTotalBytes() / 1024;
conn.log
.info(String.format("fetch records, start=%d, cnt=%d, %d KB, %.2f KB/s", cachedUpperRow,
count, totalKBytes, (float) totalKBytes / duration * 1000));
reader.close();
} catch (TunnelException | IOException e) {
throw new SQLException(e.getMessage(), e);
}
}