Genius-pig commented on a change in pull request #564: [IOTDB-190] upgrade from 
antlr3 to antlr4
URL: https://github.com/apache/incubator-iotdb/pull/564#discussion_r353004328
 
 

 ##########
 File path: 
server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
 ##########
 @@ -937,76 +699,202 @@ private TSDataType parseTypeNode(AstNode typeNode) 
throws LogicalOperatorExcepti
       case "text":
         return TSDataType.TEXT;
       default:
-        throw new LogicalOperatorException(type, "");
+        throw new SQLParserException("not a valid fill type : " + type);
     }
   }
 
-  private long parseTimeUnit(AstNode node) throws LogicalOperatorException {
-    long timeInterval = parseTokenDuration(node);
-    if (timeInterval <= 0) {
-      throw new LogicalOperatorException("Interval must more than 0.");
+  @Override
+  public void enterLimitClause(LimitClauseContext ctx) {
+    super.enterLimitClause(ctx);
+    int limit = Integer.parseInt(ctx.INT().getText());
+    if(limit <= 0) {
+      throw new SQLParserException("LIMIT <N>: N must be a positive integer 
and can not be zero.");
     }
-    return timeInterval;
   }
 
-  private Pair<Path, String> parseLeafNode(AstNode node) throws 
LogicalOperatorException {
-    if (node.getChildCount() != 2) {
-      throw new LogicalOperatorException();
+  @Override
+  public void enterSlimitClause(SlimitClauseContext ctx) {
+    super.enterSlimitClause(ctx);
+    int slimit = Integer.parseInt(ctx.INT().getText());
+    if(slimit <= 0) {
+      throw new SQLParserException("SLIMIT <SN>: SN must be a positive integer 
and can not be zero.");
     }
-    AstNode col = node.getChild(0);
-    if (col.getType() != TOK_PATH) {
-      throw new LogicalOperatorException();
-    }
-    Path seriesPath = parsePath(col);
-    AstNode rightKey = node.getChild(1);
-    String seriesValue;
-    if (rightKey.getChild(0).getType() == TqlParser.TOK_DATETIME) {
-      if (!seriesPath.equals(SQLConstant.RESERVED_TIME)) {
-        throw new LogicalOperatorException(seriesPath.toString(), "Date can 
only be used to time");
+    queryOp.setSeriesLimit(slimit);
+  }
+
+  @Override
+  public void enterOffsetClause(OffsetClauseContext ctx) {
 
 Review comment:
   It may needed in the future. 
https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-334

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to