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

hxd 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 5837269  remove duplicated codes for error tips for query 
FILL,AGGREGATION, GROUPBYTIME sql  (#2525)
5837269 is described below

commit 5837269823978216eb80b7496e337faa27ea1207
Author: Haimei Guo <[email protected]>
AuthorDate: Thu Jan 21 08:33:37 2021 +0800

    remove duplicated codes for error tips for query FILL,AGGREGATION, 
GROUPBYTIME sql  (#2525)
---
 .../main/java/org/apache/iotdb/db/service/TSServiceImpl.java | 12 ++++--------
 .../org/apache/iotdb/db/integration/IoTDBDisableAlignIT.java |  6 +++---
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java 
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 8eb978d..01b3405 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -544,14 +544,10 @@ public class TSServiceImpl implements TSIService.Iface, 
ServerContext {
       fetchSize = fetchSize == 0 ? DEFAULT_FETCH_SIZE : fetchSize;
 
       if (plan instanceof QueryPlan && !((QueryPlan) plan).isAlignByTime()) {
-        if (plan.getOperatorType() == OperatorType.AGGREGATION) {
-          throw new QueryProcessException("Aggregation doesn't support disable 
align clause.");
-        }
-        if (plan.getOperatorType() == OperatorType.FILL) {
-          throw new QueryProcessException("Fill doesn't support disable align 
clause.");
-        }
-        if (plan.getOperatorType() == OperatorType.GROUPBYTIME) {
-          throw new QueryProcessException("Group by doesn't support disable 
align clause.");
+        OperatorType operatorType = plan.getOperatorType();
+        if (operatorType == OperatorType.AGGREGATION || operatorType == 
OperatorType.FILL
+            || operatorType == OperatorType.GROUPBYTIME) {
+          throw new QueryProcessException(operatorType.name() + " doesn't 
support disable align clause.");
         }
       }
       if (plan.getOperatorType() == OperatorType.AGGREGATION) {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDisableAlignIT.java 
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDisableAlignIT.java
index 445d334..3d614ac 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDisableAlignIT.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDisableAlignIT.java
@@ -334,7 +334,7 @@ public class IoTDBDisableAlignIT {
       fail("No exception thrown.");
     } catch (Exception e) {
       Assert.assertTrue(e.getMessage().contains(
-          "Fill doesn't support disable align clause."));
+          "FILL doesn't support disable align clause."));
     }
   }
 
@@ -348,7 +348,7 @@ public class IoTDBDisableAlignIT {
           "select count(*) from root.vehicle GROUP BY ([2,50),20ms) disable 
align");
       fail("No exception thrown.");
     } catch (Exception e) {
-      Assert.assertTrue(e.getMessage().contains("Group by doesn't support 
disable align clause."));
+      Assert.assertTrue(e.getMessage().contains("GROUPBYTIME doesn't support 
disable align clause."));
     }
   }
 
@@ -363,7 +363,7 @@ public class IoTDBDisableAlignIT {
       fail("No exception thrown.");
     } catch (Exception e) {
       Assert.assertTrue(e.getMessage().contains(
-          "Aggregation doesn't support disable align clause."));
+          "AGGREGATION doesn't support disable align clause."));
     }
   }
 

Reply via email to