DongLiang-0 commented on code in PR #29039: URL: https://github.com/apache/doris/pull/29039#discussion_r1436293106
########## fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java: ########## @@ -133,18 +134,25 @@ public void close() throws IOException { protected int getNext() throws IOException { int rows = 0; try { - RecordReader.RecordIterator<InternalRow> batch; - while ((batch = reader.readBatch()) != null) { + if (recordIterator == null) { + recordIterator = reader.readBatch(); + } + + while (recordIterator != null) { InternalRow record; - while ((record = batch.next()) != null) { + while ((record = recordIterator.next()) != null) { columnValue.setOffsetRow(record); for (int i = 0; i < fields.length; i++) { columnValue.setIdx(i, types[i]); appendData(i, columnValue); } rows++; + if (rows >= batchSize) { + return rows; Review Comment: Is there some logical problem here? After returning here, the following `recordIterator.releaseBatch();` will not be executed. Can it be handled in finally? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org