You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sh...@apache.org on 2025/09/03 10:55:16 UTC
(iotdb) branch fixBug0903 created (now fac7a1501fd)
This is an automated email from the ASF dual-hosted git repository.
shuwenwei pushed a change to branch fixBug0903
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at fac7a1501fd Page time range set in TVListIterator is not processed
This branch includes the following new commits:
new fac7a1501fd Page time range set in TVListIterator is not processed
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Page time range set in TVListIterator is not processed
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuwenwei pushed a commit to branch fixBug0903
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit fac7a1501fddefc263fa6c8034b71a655eedd5c8
Author: shuwenwei <s1...@gmail.com>
AuthorDate: Wed Sep 3 18:54:58 2025 +0800
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 dedad0ee793..06d27fcf2cf 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
@@ -820,6 +820,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)
@@ -838,6 +841,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)
@@ -856,6 +862,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)
@@ -873,6 +882,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)
@@ -892,6 +904,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)
@@ -913,6 +928,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 f0ae227c05f..6da636e47e5 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
@@ -654,11 +654,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++) {
@@ -671,6 +675,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 62c801f4e34..2b06382161f 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) {