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

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

commit 06b44bc25f843683c47ec4f09ae8fbae976c6ccb
Author: shuwenwei <[email protected]>
AuthorDate: Mon Nov 3 17:14:31 2025 +0800

    SeriesScanUtil throws exception when using filters that could not match any 
time range
---
 .../relational/it/query/recent/IoTDBTableAggregationIT.java   | 11 +++++++++++
 .../queryengine/execution/operator/source/SeriesScanUtil.java |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
index c6e5fc138ce..0143bdb6e3b 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
@@ -5480,4 +5480,15 @@ public class IoTDBTableAggregationIT {
         retArray,
         DATABASE_NAME);
   }
+
+  @Test
+  public void emptyTimeRangeQueryTest() {
+    String[] expectedHeader = new String[] {"_col0"};
+    String[] retArray = new String[] {"0,"};
+    tableResultSetEqualTest(
+        "select count(*) from table1 where time >= 0 and time < -1",
+        expectedHeader,
+        retArray,
+        DATABASE_NAME);
+  }
 }
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 078408c8ff9..7a5595e9fff 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
@@ -219,6 +219,14 @@ public class SeriesScanUtil implements Accountable {
     orderUtils.setCurSeqFileIndex(dataSource);
     curUnseqFileIndex = 0;
 
+    List<TsFileResource> seqResources = dataSource.getSeqResources();
+    List<TsFileResource> unseqResources = dataSource.getUnseqResources();
+    if ((seqResources == null || seqResources.isEmpty())
+        && (unseqResources == null || unseqResources.isEmpty())) {
+      // no satisfied resources
+      return;
+    }
+
     if (satisfiedTimeRange == null) {
       long startTime = Long.MAX_VALUE;
       long endTime = Long.MIN_VALUE;

Reply via email to