You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2022/01/14 04:08:12 UTC

[shardingsphere] branch master updated: fix github ci exception with sql parse (#14754)

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

menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 2481dd5  fix github ci exception with sql parse (#14754)
2481dd5 is described below

commit 2481dd5e872afe4d9f2fb02319a3a60120259a9f
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri Jan 14 12:07:16 2022 +0800

    fix github ci exception with sql parse (#14754)
    
    * fix github ci exception
    
    * fix github ci exception with integration test
    
    * fix github ci exception with integration test
    
    * fix github ci exception with integration test
    
    * fix github ci exception with integration test
    
    * Revert "fix github ci exception with integration test"
    
    This reverts commit 8f441ac3da85965eaf9399eb77f89eaf56e3e744.
    
    * Revert "fix github ci exception with integration test"
    
    This reverts commit fa91e87a69f9b3eae713b08b53815c8ecfb18337.
    
    * Revert "fix github ci exception with integration test"
    
    This reverts commit 28fbd37f52b8a73b63f8a8bf447b47be690c1fa0.
    
    * Revert "fix github ci exception with integration test"
    
    This reverts commit 4b9921044a3816f317b76a090d935b24274c4c1d.
---
 .../visitor/statement/impl/MySQLDALStatementSQLVisitor.java    | 10 ++++++----
 .../sql/dialect/statement/mysql/dal/MySQLResetStatement.java   |  2 +-
 .../cases/domain/statement/dal/ResetStatementTestCase.java     |  3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 3fe4281..6ea6c14 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -21,8 +21,6 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.operation.SQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.visitor.type.DALSQLVisitor;
-import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.HelpContext;
-import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowEventsContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AlterResourceGroupContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AnalyzeTableContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.BinaryLogFileIndexNumberContext;
@@ -45,6 +43,7 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.Explain
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FlushContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FromSchemaContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FromTableContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.HelpContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.IndexNameContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InstallComponentContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InstallPluginContext;
@@ -83,6 +82,7 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowDat
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowEngineContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowEnginesContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowErrorsContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowEventsContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowFilterContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowFunctionStatusContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowIndexContext;
@@ -305,7 +305,9 @@ public final class MySQLDALStatementSQLVisitor extends MySQLStatementSQLVisitor
         }
         MySQLResetStatement result = new MySQLResetStatement();
         for (ResetOptionContext each : ctx.resetOption()) {
-            result.getOptions().add((ResetOptionSegment) (visit(each)));
+            if (null != each.MASTER() || null != each.SLAVE()) {
+                result.getOptions().add((ResetOptionSegment) (visit(each)));
+            }
         }
         return result;
     }
@@ -445,7 +447,7 @@ public final class MySQLDALStatementSQLVisitor extends MySQLStatementSQLVisitor
     @Override
     public ASTNode visitKill(final KillContext ctx) {
         MySQLKillStatement result = new MySQLKillStatement();
-        result.setProcesslistId(ctx.getText());
+        result.setProcesslistId(ctx.NUMBER_().getText());
         return result;
     }
     
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetStatement.java
index da604f5..c419e6e 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetStatement.java
@@ -34,5 +34,5 @@ import java.util.List;
 @Getter
 public final class MySQLResetStatement extends AbstractSQLStatement implements DALStatement, MySQLStatement {
     
-    private List<ResetOptionSegment> options = new LinkedList<>();
+    private final List<ResetOptionSegment> options = new LinkedList<>();
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetStatementTestCase.java
index 5de1e48..2d80098 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetStatementTestCase.java
@@ -22,6 +22,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 
 import javax.xml.bind.annotation.XmlElement;
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -31,5 +32,5 @@ import java.util.List;
 public final class ResetStatementTestCase extends SQLParserTestCase {
 
     @XmlElement(name = "option")
-    private List<ExpectedResetOptionSegment> options;
+    private List<ExpectedResetOptionSegment> options = new LinkedList<>();
 }