This is an automated email from the ASF dual-hosted git repository.

shuwenwei pushed a commit to branch skipNotSatisfiedTimeRange
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/skipNotSatisfiedTimeRange by 
this push:
     new e51042f8107 fix ut
e51042f8107 is described below

commit e51042f81073151c5d40704ed0c5378807c68ea9
Author: shuwenwei <[email protected]>
AuthorDate: Fri Oct 10 17:58:27 2025 +0800

    fix ut
---
 .../execution/operator/source/SeriesScanUtil.java    |  3 ++-
 .../apache/iotdb/db/utils/datastructure/TVList.java  | 16 ++++++++++++----
 .../memtable/AlignedTVListIteratorTest.java          |  2 +-
 .../memtable/NonAlignedTVListIteratorTest.java       | 20 ++++++++++----------
 4 files changed, 25 insertions(+), 16 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
index b984f832081..e5a1ac4b94e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
@@ -134,7 +134,8 @@ public class SeriesScanUtil implements Accountable {
           + RamUsageEstimator.shallowSizeOfInstance(IDeviceID.class)
           + RamUsageEstimator.shallowSizeOfInstance(TimeOrderUtils.class)
           + RamUsageEstimator.shallowSizeOfInstance(PaginationController.class)
-          + RamUsageEstimator.shallowSizeOfInstance(SeriesScanOptions.class);
+          + RamUsageEstimator.shallowSizeOfInstance(SeriesScanOptions.class)
+          + RamUsageEstimator.shallowSizeOfInstance(TimeRange.class);
 
   protected TimeRange satisfiedTimeRange;
   protected boolean noMoreSatisfiedData = false;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
index ddca1059338..7b98c548867 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
@@ -736,13 +736,16 @@ public abstract class TVList implements WALEntryValue {
       if (timeRange == null || index >= rows) {
         return;
       }
-      if (probeNext && timeRange.contains(getTime(getScanOrderIndex(index)))) {
+      if (timeRange.contains(getTime(getScanOrderIndex(index)))) {
         return;
       }
 
       int indexInTVList;
       if (scanOrder.isAscending()) {
         long searchTimestamp = timeRange.getMin();
+        if (searchTimestamp <= outer.getMinTime()) {
+          return;
+        }
         if (searchTimestamp > outer.getMaxTime()) {
           // all satisfied data has been consumed
           index = rows;
@@ -755,9 +758,11 @@ public abstract class TVList implements WALEntryValue {
         boolean foundSearchedTime = searchTimestamp == getTime(indexInTVList);
         if (!foundSearchedTime) {
           // move to the min index of next timestamp index
-          do {
-            indexInTVList++;
-          } while (indexInTVList < rows && getTime(indexInTVList) == 
searchTimestamp);
+          if (indexInTVList != 0) {
+            do {
+              indexInTVList++;
+            } while (indexInTVList < rows && getTime(indexInTVList) == 
searchTimestamp);
+          }
         } else {
           // move to the min index of current timestamp
           while (indexInTVList > 0 && getTime(indexInTVList - 1) == 
searchTimestamp) {
@@ -766,6 +771,9 @@ public abstract class TVList implements WALEntryValue {
         }
       } else {
         long searchTimestamp = timeRange.getMax();
+        if (searchTimestamp >= outer.getMaxTime()) {
+          return;
+        }
         if (searchTimestamp < outer.getMinTime()) {
           // all satisfied data has been consumed
           index = rows;
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedTVListIteratorTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedTVListIteratorTest.java
index cec78381c5a..a8adcd17e81 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedTVListIteratorTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedTVListIteratorTest.java
@@ -845,7 +845,7 @@ public class AlignedTVListIteratorTest {
   }
 
   @Test
-  public void test() throws QueryProcessException, IOException {
+  public void testSkipTimeRange() throws QueryProcessException, IOException {
     List<Map<TVList, Integer>> list =
         Arrays.asList(
             buildAlignedSingleTvListMap(
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/NonAlignedTVListIteratorTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/NonAlignedTVListIteratorTest.java
index 8aaaf76e39b..b28979efd67 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/NonAlignedTVListIteratorTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/NonAlignedTVListIteratorTest.java
@@ -449,15 +449,15 @@ public class NonAlignedTVListIteratorTest {
         deletions,
         true,
         expectedCount);
-    //    testNonAligned(
-    //        largeMergeSortMultiTvListMap,
-    //        scanOrder,
-    //        globalTimeFilter,
-    //        pushDownFilter,
-    //        duplicatePaginationController(paginationController),
-    //        deletions,
-    //        true,
-    //        expectedCount);
+    testNonAligned(
+        largeMergeSortMultiTvListMap,
+        scanOrder,
+        globalTimeFilter,
+        pushDownFilter,
+        duplicatePaginationController(paginationController),
+        deletions,
+        true,
+        expectedCount);
   }
 
   private PaginationController duplicatePaginationController(
@@ -632,7 +632,7 @@ public class NonAlignedTVListIteratorTest {
   }
 
   @Test
-  public void test() throws QueryProcessException, IOException {
+  public void testSkipTimeRange() throws QueryProcessException, IOException {
     List<Map<TVList, Integer>> list =
         Arrays.asList(
             buildNonAlignedSingleTvListMap(

Reply via email to