You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by er...@apache.org on 2022/10/25 07:59:11 UTC

[iotdb] branch bugfix/iotdb-4751 created (now f7317dfb24)

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

ericpai pushed a change to branch bugfix/iotdb-4751
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at f7317dfb24 [IOTDB-4751] Fix GROUP BY TAGS with HAVING clause being without any error message

This branch includes the following new commits:

     new f7317dfb24 [IOTDB-4751] Fix GROUP BY TAGS with HAVING clause being without any error message

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [IOTDB-4751] Fix GROUP BY TAGS with HAVING clause being without any error message

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ericpai pushed a commit to branch bugfix/iotdb-4751
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit f7317dfb2450119576a65b20e96d1b84c1514032
Author: ericpai <er...@hotmail.com>
AuthorDate: Tue Oct 25 15:58:33 2022 +0800

    [IOTDB-4751] Fix GROUP BY TAGS with HAVING clause being without any error message
---
 .../iotdb/db/it/aggregation/IoTDBTagAggregationIT.java   | 16 ++++++++++++++++
 .../apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java |  3 +++
 2 files changed, 19 insertions(+)

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 e679657064..695bae88d3 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
@@ -511,4 +511,20 @@ public class IoTDBTagAggregationIT {
           e.getMessage().contains("Only time filters are supported in GROUP BY TAGS query"));
     }
   }
+
+  @Test
+  public void testWithHaving() {
+    String query =
+        "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1) HAVING COUNT(t) > 3";
+    // Having is not supported yet
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      try (ResultSet ignored = statement.executeQuery(query)) {
+        Assert.fail();
+      }
+    } catch (SQLException e) {
+      Assert.assertTrue(
+          e.getMessage().contains("Having clause is not supported yet in GROUP BY TAGS query"));
+    }
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
index 925d5558ec..5b0626f601 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
@@ -700,6 +700,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     if (analysis.hasValueFilter()) {
       throw new SemanticException("Only time filters are supported in GROUP BY TAGS query");
     }
+    if (queryStatement.hasHaving()) {
+      throw new SemanticException("Having clause is not supported yet in GROUP BY TAGS query");
+    }
     Map<List<String>, LinkedHashMap<Expression, List<Expression>>>
         tagValuesToGroupedTimeseriesOperands = new HashMap<>();
     LinkedHashMap<Expression, Set<Expression>> groupByTagOutputExpressions = new LinkedHashMap<>();