Alima777 commented on a change in pull request #2859:
URL: https://github.com/apache/iotdb/pull/2859#discussion_r597391720



##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
##########
@@ -127,13 +126,17 @@ private boolean cacheRowRecords() throws IOException {
       }
     }
     // 4. remove rowRecord if all values in one timestamp are null
-    for (int i = 0; i < cachedTimeCnt; i++) {
+    // traverse in reversed order to get element efficiently
+    for (int i = cachedTimeCnt - 1; i >= 0; i--) {
       if (hasField[i]) {
         cachedRowRecords.add(rowRecords[i]);
       }
     }
 
     // 5. check whether there is next row record
+    if (cachedRowRecords.isEmpty() && timeGenerator.hasNext()) {
+      return cacheRowRecords();
+    }

Review comment:
       I've added comments for this.




-- 
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]


Reply via email to