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

JackieTien97 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 63ae4d1c8cc [To dev/1.3] Fix row-order assumptions in time duration 
tag aggregation IT (#18998)
63ae4d1c8cc is described below

commit 63ae4d1c8ccaa4fd9de361a1a5feb895ad70e64b
Author: Caideyipi <[email protected]>
AuthorDate: Sat Oct 24 07:26:07 2026 +0800

    [To dev/1.3] Fix row-order assumptions in time duration tag aggregation IT 
(#18998)
---
 .../db/it/aggregation/IoTDBTimeDurationIT.java     | 41 ++++++++++++++++++++--
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTimeDurationIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTimeDurationIT.java
index 0be9aa74107..762c38bb048 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTimeDurationIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTimeDurationIT.java
@@ -19,7 +19,9 @@
 
 package org.apache.iotdb.db.it.aggregation;
 
+import org.apache.iotdb.isession.SessionConfig;
 import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper;
 import org.apache.iotdb.it.framework.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
@@ -31,9 +33,20 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
 import static org.apache.iotdb.db.it.utils.TestUtils.assertTestFail;
 import static org.apache.iotdb.db.it.utils.TestUtils.prepareData;
 import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 @RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
@@ -213,7 +226,7 @@ public class IoTDBTimeDurationIT {
   }
 
   @Test
-  public void testTimeDurationManyColumnOnManyDataRegion() {
+  public void testTimeDurationManyColumnOnManyDataRegion() throws SQLException 
{
     // normal
     String[] expectedHeader =
         new String[] {
@@ -343,8 +356,30 @@ public class IoTDBTimeDurationIT {
     // group by tags
     expectedHeader = new String[] {"city", "time_duration(s1)"};
     retArray = new String[] {"Beijing,1677570933,", "Nanjing,1677570938,"};
-    resultSetEqualTest(
-        "select time_duration(s1) from root.** group by tags(city)", 
expectedHeader, retArray);
+    // GROUP BY TAGS does not guarantee row order, so check each DataNode 
independently.
+    for (DataNodeWrapper dataNode : 
EnvFactory.getEnv().getDataNodeWrapperList()) {
+      try (Connection connection =
+              EnvFactory.getEnv()
+                  .getConnection(
+                      dataNode, SessionConfig.DEFAULT_USER, 
SessionConfig.DEFAULT_PASSWORD);
+          Statement statement = connection.createStatement();
+          ResultSet resultSet =
+              statement.executeQuery(
+                  "select time_duration(s1) from root.db1.**,root.db.** group 
by tags(city)")) {
+        ResultSetMetaData metaData = resultSet.getMetaData();
+        assertEquals(expectedHeader.length, metaData.getColumnCount());
+        for (int i = 0; i < expectedHeader.length; i++) {
+          assertEquals(expectedHeader[i], metaData.getColumnName(i + 1));
+        }
+        Set<String> remainingRows = new HashSet<>(Arrays.asList(retArray));
+        while (resultSet.next()) {
+          String row =
+              resultSet.getString("city") + "," + 
resultSet.getString("time_duration(s1)") + ",";
+          assertTrue(dataNode.getIpAndPortString() + ": " + row, 
remainingRows.remove(row));
+        }
+        assertTrue(dataNode.getIpAndPortString() + ": " + remainingRows, 
remainingRows.isEmpty());
+      }
+    }
 
     // group by time
     expectedHeader =

Reply via email to