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

jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 0dcd3e69be5 [to dev/1.3] Page time range set in TVListIterator is not 
processed
0dcd3e69be5 is described below

commit 0dcd3e69be50ab35834ccddced6be511240039fb
Author: shuwenwei <[email protected]>
AuthorDate: Thu Sep 4 09:56:07 2025 +0800

    [to dev/1.3] Page time range set in TVListIterator is not processed
---
 .../apache/iotdb/db/utils/datastructure/TVList.java    | 18 ++++++++++++++++++
 .../dataregion/memtable/AlignedTVListIteratorTest.java | 14 ++++++++++----
 .../memtable/NonAlignedTVListIteratorTest.java         | 11 +++++++++--
 3 files changed, 37 insertions(+), 6 deletions(-)

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 c88968d6ffa..e37fdec551e 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
@@ -813,6 +813,9 @@ public abstract class TVList implements WALEntryValue {
         case BOOLEAN:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
@@ -831,6 +834,9 @@ public abstract class TVList implements WALEntryValue {
         case DATE:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
@@ -849,6 +855,9 @@ public abstract class TVList implements WALEntryValue {
         case TIMESTAMP:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
@@ -866,6 +875,9 @@ public abstract class TVList implements WALEntryValue {
         case FLOAT:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
@@ -885,6 +897,9 @@ public abstract class TVList implements WALEntryValue {
         case DOUBLE:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
@@ -906,6 +921,9 @@ public abstract class TVList implements WALEntryValue {
         case STRING:
           while (index < rows && builder.getPositionCount() < 
maxNumberOfPointsInPage) {
             long time = getTime(getScanOrderIndex(index));
+            if (isCurrentTimeExceedTimeRange(time)) {
+              break;
+            }
             if (!isNullValue(getValueIndex(getScanOrderIndex(index)))
                 && !isPointDeleted(time, deletionList, deleteCursor, scanOrder)
                 && isLatestPoint(index, time)
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 59e58182f6f..758e0869f2c 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
@@ -618,11 +618,15 @@ public class AlignedTVListIteratorTest {
     List<Statistics<? extends Serializable>> pageStatisticsList = 
chunk.getTimeStatisticsList();
     int count = 0;
     long offset = paginationController.getCurOffset();
+    if (!scanOrder.isAscending()) {
+      Collections.reverse(pageStatisticsList);
+    }
     for (Statistics<? extends Serializable> statistics : pageStatisticsList) {
-      if (statistics.getStartTime() <= statistics.getEndTime()) {
-        memPointIterator.setCurrentPageTimeRange(
-            new TimeRange(statistics.getStartTime(), statistics.getEndTime()));
-      }
+      TimeRange currentTimeRange =
+          (statistics.getStartTime() <= statistics.getEndTime())
+              ? new TimeRange(statistics.getStartTime(), 
statistics.getEndTime())
+              : null;
+      memPointIterator.setCurrentPageTimeRange(currentTimeRange);
       while (memPointIterator.hasNextBatch()) {
         TsBlock tsBlock = memPointIterator.nextBatch();
         for (int i = 0; i < tsBlock.getPositionCount(); i++) {
@@ -635,6 +639,8 @@ public class AlignedTVListIteratorTest {
             count++;
           }
           long currentTimestamp = tsBlock.getTimeByIndex(i);
+          Assert.assertTrue(
+              currentTimeRange == null || 
currentTimeRange.contains(currentTimestamp));
           Long int64Value = tsBlock.getColumn(0).isNull(i) ? null : 
tsBlock.getColumn(0).getLong(i);
           Boolean boolValue =
               tsBlock.getColumn(1).isNull(i) ? null : 
tsBlock.getColumn(1).getBoolean(i);
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 a984eaada1f..c22dcbb6b0f 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
@@ -497,9 +497,15 @@ public class NonAlignedTVListIteratorTest {
     List<Statistics<? extends Serializable>> pageStatisticsList = 
chunk.getPageStatisticsList();
     int count = 0;
     long offset = paginationController.getCurOffset();
+    if (!scanOrder.isAscending()) {
+      Collections.reverse(pageStatisticsList);
+    }
     for (Statistics<? extends Serializable> statistics : pageStatisticsList) {
-      memPointIterator.setCurrentPageTimeRange(
-          new TimeRange(statistics.getStartTime(), statistics.getEndTime()));
+      TimeRange currentTimeRange =
+          (statistics.getStartTime() <= statistics.getEndTime())
+              ? new TimeRange(statistics.getStartTime(), 
statistics.getEndTime())
+              : null;
+      memPointIterator.setCurrentPageTimeRange(currentTimeRange);
       while (memPointIterator.hasNextBatch()) {
         TsBlock tsBlock = memPointIterator.nextBatch();
         for (int i = 0; i < tsBlock.getPositionCount(); i++) {
@@ -512,6 +518,7 @@ public class NonAlignedTVListIteratorTest {
             count++;
           }
           long currentTimestamp = tsBlock.getTimeByIndex(i);
+          Assert.assertTrue(currentTimeRange.contains(currentTimestamp));
           long value = tsBlock.getColumn(0).getLong(i);
           Assert.assertEquals(currentTimestamp, value);
           if (globalTimeFilter != null) {

Reply via email to