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

chenyz pushed a commit to branch builtin-udtf
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit b6bda6d986e4de75670ef26cb74c17ae55f4ca29
Author: Chen YZ <[email protected]>
AuthorDate: Mon Mar 17 16:41:01 2025 +0800

    save
---
 .../relational/planner/distribute/TableDistributedPlanGenerator.java | 4 ++--
 .../execution/operator/process/tvf/TableFunctionOperatorTest.java    | 3 ++-
 .../commons/udf/builtin/relational/tvf/SessionTableFunction.java     | 5 ++++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
index 19e7139fafe..7f8ca7a4883 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
@@ -494,8 +494,8 @@ public class TableDistributedPlanGenerator
   public List<PlanNode> visitDeviceTableScan(
       final DeviceTableScanNode node, final PlanContext context) {
     if (context.isPushDownGrouping()) {
-      //      return constructDeviceTableScanByTags(node, context);
-      return constructDeviceTableScanTmp(node, context);
+      return constructDeviceTableScanByTags(node, context);
+//      return constructDeviceTableScanTmp(node, context);
     } else {
       return constructDeviceTableScanByRegionReplicaSet(node, context);
     }
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/process/tvf/TableFunctionOperatorTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/process/tvf/TableFunctionOperatorTest.java
index bba3661cfb3..687d15a8fb6 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/process/tvf/TableFunctionOperatorTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/process/tvf/TableFunctionOperatorTest.java
@@ -203,7 +203,7 @@ public class TableFunctionOperatorTest {
               Collections.singletonList(1),
               Arrays.asList(0, 1, 3),
               Arrays.asList(0, 1, 2, 3),
-              Arrays.asList(TSDataType.TIMESTAMP, TSDataType.STRING, 
TSDataType.INT32));
+              Arrays.asList(TSDataType.TIMESTAMP, TSDataType.STRING, 
TSDataType.DOUBLE, TSDataType.INT32));
       PartitionState state = partitionRecognizer.nextState();
       Assert.assertEquals(PartitionState.INIT_STATE, state);
       Assert.assertEquals(PartitionState.INIT_STATE, 
partitionRecognizer.nextState());
@@ -281,6 +281,7 @@ public class TableFunctionOperatorTest {
       state = partitionRecognizer.nextState();
       Assert.assertEquals(PartitionState.StateType.FINISHED, 
state.getStateType());
     } catch (Exception e) {
+      e.printStackTrace();
       fail(e.getMessage());
     }
   }
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/SessionTableFunction.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/SessionTableFunction.java
index a3f49840734..bd6b3186ce3 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/SessionTableFunction.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/SessionTableFunction.java
@@ -114,9 +114,12 @@ public class SessionTableFunction implements TableFunction 
{
       long timeValue = input.getLong(0);
       if (!currentRowIndexes.isEmpty() && timeValue > windowEnd) {
         outputWindow(properColumnBuilders, passThroughIndexBuilder);
+
+      }
+      if (currentRowIndexes.isEmpty()) {
+        windowStart = timeValue;
       }
       currentRowIndexes.add(curIndex);
-      windowStart = timeValue;
       windowEnd = timeValue + gap;
       curIndex++;
     }

Reply via email to