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

haonan pushed a commit to branch rc/1.2.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 69e22d0d1c39ae3ba45606bd88810ec266824f34
Author: HTHou <[email protected]>
AuthorDate: Tue Sep 26 19:10:23 2023 +0800

    Revert "[IOTDB-6137] Improved error messages for expressions as constants 
in GROUP BY"
    
    This reverts commit e59d3e044ec42e37bb19d3238bb1bb5a7edbd417.
---
 .../db/queryengine/plan/parser/ASTVisitor.java     | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
index f3e394c5808..61679718299 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
@@ -1575,14 +1575,8 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
     if (windowType == WindowType.VARIATION_WINDOW) {
       ExpressionContext expressionContext = expressions.get(0);
       GroupByVariationComponent groupByVariationComponent = new 
GroupByVariationComponent();
-      Expression expression = parseExpression(expressionContext, true);
-      if (expression.isConstantOperand()) {
-        throw new SemanticException(
-            String.format(
-                "Constant operand [%s] is not allowed in group by variation, 
there should be an expression",
-                expression.getExpressionString()));
-      }
-      groupByVariationComponent.setControlColumnExpression(expression);
+      groupByVariationComponent.setControlColumnExpression(
+          parseExpression(expressionContext, true));
       groupByVariationComponent.setDelta(
           ctx.delta == null ? 0 : Double.parseDouble(ctx.delta.getText()));
       groupByVariationComponent.setIgnoringNull(ignoringNull);
@@ -1594,8 +1588,6 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
           parseExpression(conditionExpressionContext, true));
       if (expressions.size() == 2) {
         
groupByConditionComponent.setKeepExpression(parseExpression(expressions.get(1), 
true));
-      } else {
-        throw new SemanticException("Keep threshold in group by condition 
should be set");
       }
       groupByConditionComponent.setIgnoringNull(ignoringNull);
       return groupByConditionComponent;
@@ -1606,14 +1598,8 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
       ExpressionContext countExpressionContext = expressions.get(0);
       long countNumber = Long.parseLong(ctx.countNumber.getText());
       GroupByCountComponent groupByCountComponent = new 
GroupByCountComponent(countNumber);
-      Expression expression = parseExpression(countExpressionContext, true);
-      if (expression.isConstantOperand()) {
-        throw new SemanticException(
-            String.format(
-                "Constant operand [%s] is not allowed in group by count, there 
should be an expression",
-                expression.getExpressionString()));
-      }
-      groupByCountComponent.setControlColumnExpression(expression);
+      groupByCountComponent.setControlColumnExpression(
+          parseExpression(countExpressionContext, true));
       groupByCountComponent.setIgnoringNull(ignoringNull);
       return groupByCountComponent;
     } else {

Reply via email to