You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/01/15 05:15:30 UTC

[iotdb] branch master updated: [ISSUE-2416] Sql statement with unsupported mark doesn't be handled correctly (#2499)

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

haonan 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 f81d2fb  [ISSUE-2416] Sql statement with unsupported mark doesn't be handled correctly (#2499)
f81d2fb is described below

commit f81d2fb7a25aff316d008aae71a11634e22d2c91
Author: Irvine <ir...@gmail.com>
AuthorDate: Fri Jan 15 13:15:10 2021 +0800

    [ISSUE-2416] Sql statement with unsupported mark doesn't be handled correctly (#2499)
---
 .../main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index 7ff4d78..26c5cd6 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -43,6 +43,8 @@ public class LogicalGenerator {
     ioTDBSqlVisitor.setZoneId(zoneId);
     CharStream charStream1 = CharStreams.fromString(sql);
     SqlBaseLexer lexer1 = new SqlBaseLexer(charStream1);
+    lexer1.removeErrorListeners();
+    lexer1.addErrorListener(SQLParseError.INSTANCE);
     CommonTokenStream tokens1 = new CommonTokenStream(lexer1);
     SqlBaseParser parser1 = new SqlBaseParser(tokens1);
     parser1.getInterpreter().setPredictionMode(PredictionMode.SLL);
@@ -54,6 +56,8 @@ public class LogicalGenerator {
     } catch (Exception ex) {
       CharStream charStream2 = CharStreams.fromString(sql);
       SqlBaseLexer lexer2 = new SqlBaseLexer(charStream2);
+      lexer2.removeErrorListeners();
+      lexer2.addErrorListener(SQLParseError.INSTANCE);
       CommonTokenStream tokens2 = new CommonTokenStream(lexer2);
       SqlBaseParser parser2 = new SqlBaseParser(tokens2);
       parser2.getInterpreter().setPredictionMode(PredictionMode.LL);