This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 2ae6ae9c48 Fix unexcepted error message when use raw query with Group
By Tag
2ae6ae9c48 is described below
commit 2ae6ae9c4815ed473464a0015ab2a72d05279cc0
Author: Weihao Li <[email protected]>
AuthorDate: Fri Apr 14 08:46:36 2023 +0800
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 f2fffba941..9f6d158037 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
@@ -439,7 +439,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");
}