jt2594838 commented on a change in pull request #2859:
URL: https://github.com/apache/iotdb/pull/2859#discussion_r595806236
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
##########
@@ -64,102 +65,144 @@ public RawQueryDataSetWithValueFilter(
@Override
public boolean hasNextWithoutConstraint() throws IOException {
- if (hasCachedRow) {
+ if (!cachedRowRecords.isEmpty()) {
return true;
}
- return cacheRowRecord();
+ return cacheRowRecords();
}
+ /** @return the first record of cached rows or null if there is no more data
*/
@Override
public RowRecord nextWithoutConstraint() throws IOException {
- if (!hasCachedRow && !cacheRowRecord()) {
+ if (cachedRowRecords.isEmpty() && !cacheRowRecords()) {
return null;
}
- hasCachedRow = false;
- return cachedRowRecord;
+
+ return cachedRowRecords.remove(0);
Review comment:
`remove(0)` of `ArrayList` is not very efficient. And considering
`LinkedList` itself is not fast, I would recommend using a stack and insert
`RowRecords` into it during `cacheRowRecords` with a reversed order.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]