liuminghui233 commented on code in PR #11631:
URL: https://github.com/apache/iotdb/pull/11631#discussion_r1411511424


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java:
##########
@@ -106,44 +107,51 @@ private void doFilter(Object row, int rowIndex, BatchData 
batchData) {
     }
   }
 
-  private boolean pageSatisfy() {
+  private boolean pageCanSkip() {
     Statistics<? extends Serializable> statistics = getStatistics();
-    if (valueFilter == null || valueFilter.allSatisfy(statistics)) {
-      // For aligned series, When we only query some measurements under an 
aligned device, if any
-      // values of these queried measurements has the same value count as the 
time column, the
-      // timestamp will be selected.
-      // NOTE: if we change the query semantic in the future for aligned 
series, we need to remove
-      // this check here.
-      long rowCount = getTimeStatistics().getCount();
-      boolean canUse = queryAllSensors || getValueStatisticsList().isEmpty();
-      if (!canUse) {
-        for (Statistics<? extends Serializable> vStatistics : 
getValueStatisticsList()) {
-          if (vStatistics != null && !vStatistics.hasNullValue(rowCount)) {
-            canUse = true;
-            break;
-          }
-        }
-      }
-      if (!canUse) {
-        return true;
-      }
-      // When the number of points in all value pages is the same as that in 
the time page, it means
-      // that there is no null value, and all timestamps will be selected.
-      if (paginationController.hasCurOffset(rowCount)) {
-        paginationController.consumeOffset(rowCount);
+    if (valueFilter != null && !valueFilter.allSatisfy(statistics)) {
+      return valueFilter.canSkip(statistics);
+    }
+
+    if (!canSkipOffsetByStatistics()) {
+      return false;
+    }
+
+    long rowCount = getTimeStatistics().getCount();
+    if (paginationController.hasCurOffset(rowCount)) {
+      paginationController.consumeOffset(rowCount);
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  private boolean canSkipOffsetByStatistics() {
+    if (queryAllSensors || getValueStatisticsList().isEmpty()) {
+      return true;
+    }
+
+    // For aligned series, When we only query some measurements under an 
aligned device, if any
+    // values of these queried measurements has the same value count as the 
time column, the
+    // timestamp will be selected.
+    // NOTE: if we change the query semantic in the future for aligned series, 
we need to remove
+    // this check here.
+    long rowCount = getTimeStatistics().getCount();
+    for (Statistics<? extends Serializable> vStatistics : 
getValueStatisticsList()) {
+      if (vStatistics != null && vStatistics.hasNullValue(rowCount)) {
         return false;

Review Comment:
   fixed



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java:
##########
@@ -106,44 +107,51 @@ private void doFilter(Object row, int rowIndex, BatchData 
batchData) {
     }
   }
 
-  private boolean pageSatisfy() {
+  private boolean pageCanSkip() {
     Statistics<? extends Serializable> statistics = getStatistics();
-    if (valueFilter == null || valueFilter.allSatisfy(statistics)) {
-      // For aligned series, When we only query some measurements under an 
aligned device, if any
-      // values of these queried measurements has the same value count as the 
time column, the
-      // timestamp will be selected.
-      // NOTE: if we change the query semantic in the future for aligned 
series, we need to remove
-      // this check here.
-      long rowCount = getTimeStatistics().getCount();
-      boolean canUse = queryAllSensors || getValueStatisticsList().isEmpty();
-      if (!canUse) {
-        for (Statistics<? extends Serializable> vStatistics : 
getValueStatisticsList()) {
-          if (vStatistics != null && !vStatistics.hasNullValue(rowCount)) {
-            canUse = true;
-            break;
-          }
-        }
-      }
-      if (!canUse) {
-        return true;
-      }
-      // When the number of points in all value pages is the same as that in 
the time page, it means
-      // that there is no null value, and all timestamps will be selected.
-      if (paginationController.hasCurOffset(rowCount)) {
-        paginationController.consumeOffset(rowCount);
+    if (valueFilter != null && !valueFilter.allSatisfy(statistics)) {
+      return valueFilter.canSkip(statistics);
+    }
+
+    if (!canSkipOffsetByStatistics()) {
+      return false;
+    }
+
+    long rowCount = getTimeStatistics().getCount();
+    if (paginationController.hasCurOffset(rowCount)) {
+      paginationController.consumeOffset(rowCount);
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  private boolean canSkipOffsetByStatistics() {
+    if (queryAllSensors || getValueStatisticsList().isEmpty()) {
+      return true;
+    }
+
+    // For aligned series, When we only query some measurements under an 
aligned device, if any
+    // values of these queried measurements has the same value count as the 
time column, the
+    // timestamp will be selected.
+    // NOTE: if we change the query semantic in the future for aligned series, 
we need to remove
+    // this check here.
+    long rowCount = getTimeStatistics().getCount();
+    for (Statistics<? extends Serializable> vStatistics : 
getValueStatisticsList()) {
+      if (vStatistics != null && vStatistics.hasNullValue(rowCount)) {
         return false;
-      } else {
-        return true;
       }
-    } else {
-      return valueFilter.satisfy(statistics);
     }
+
+    // When the number of points in all value pages is the same as that in the 
time page, it means
+    // that there is no null value, and all timestamps will be selected.
+    return true;

Review Comment:
   fixed



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to