You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/04/14 09:39:01 UTC

[iotdb] branch rel/1.1 updated: [To rel/1.1] Fix unexcepted error message when use raw query with Group By Tag

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

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


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new 046ada8645 [To rel/1.1] Fix unexcepted error message when use raw query with Group By Tag
046ada8645 is described below

commit 046ada8645b9df773d73194a4cb6a45c6133835b
Author: Weihao Li <60...@users.noreply.github.com>
AuthorDate: Fri Apr 14 17:38:54 2023 +0800

    [To rel/1.1] Fix unexcepted error message when use raw query with Group By Tag
---
 .../apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java  | 10 ++++++++++
 .../iotdb/db/mpp/plan/statement/crud/QueryStatement.java       |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
index acd72723a0..ed0a1c66c4 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.db.it.aggregation;
 import org.apache.iotdb.it.env.EnvFactory;
 import org.apache.iotdb.it.framework.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
+import org.apache.iotdb.rpc.TSStatusCode;
 
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -40,6 +41,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static org.apache.iotdb.db.it.utils.TestUtils.assertTestFail;
 import static org.junit.Assert.fail;
 
 @RunWith(IoTDBTestRunner.class)
@@ -580,4 +582,12 @@ public class IoTDBTagAggregationIT {
       fail(e.getMessage());
     }
   }
+
+  @Test
+  public void testWithRawInSelect() {
+    assertTestFail(
+        "SELECT s1 FROM root.case2.** GROUP BY TAGS(k1)",
+        TSStatusCode.SEMANTIC_ERROR.getStatusCode()
+            + ": Common queries and aggregated queries are not allowed to appear at the same time");
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
index 2be3358e20..2ee9e9a745 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
@@ -435,7 +435,7 @@ public class QueryStatement extends Statement {
         }
       }
     } else {
-      if (isGroupBy() || isGroupByLevel()) {
+      if (isGroupBy() || isGroupByLevel() || isGroupByTag()) {
         throw new SemanticException(
             "Common queries and aggregated queries are not allowed to appear at the same time");
       }