|
111 | 111 | import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.WhileStatementContext; |
112 | 112 | import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DoStatementContext; |
113 | 113 | import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ExplainContext; |
| 114 | +import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AnalyzeTableContext; |
114 | 115 | import org.apache.shardingsphere.sql.parser.engine.mysql.visitor.statement.MySQLStatementVisitor; |
115 | 116 | import org.apache.shardingsphere.sql.parser.statement.core.enums.AlgorithmOption; |
116 | 117 | import org.apache.shardingsphere.sql.parser.statement.core.enums.LockTableOption; |
|
154 | 155 | import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment; |
155 | 156 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment; |
156 | 157 | import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; |
| 158 | +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.AnalyzeTableStatement; |
157 | 159 | import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement; |
158 | 160 | import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DeallocateStatement; |
159 | 161 | import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.ExecuteStatement; |
@@ -861,11 +863,19 @@ private ValidStatementSegment createValidStatementSegment(final ValidStatementCo |
861 | 863 | sqlStatement = (DoStatement) visit(ctx.doStatement()); |
862 | 864 | } else if (null != ctx.explain()) { |
863 | 865 | sqlStatement = (SQLStatement) visit(ctx.explain()); |
| 866 | + } else if (null != ctx.analyzeTable()) { |
| 867 | + sqlStatement = (AnalyzeTableStatement) visit(ctx.analyzeTable()); |
864 | 868 | } |
865 | 869 | result.setSqlStatement(sqlStatement); |
866 | 870 | return result; |
867 | 871 | } |
868 | 872 |
|
| 873 | + @SuppressWarnings("unchecked") |
| 874 | + @Override |
| 875 | + public ASTNode visitAnalyzeTable(final AnalyzeTableContext ctx) { |
| 876 | + return new AnalyzeTableStatement(getDatabaseType(), ((CollectionValue<SimpleTableSegment>) visit(ctx.tableList())).getValue()); |
| 877 | + } |
| 878 | + |
869 | 879 | @Override |
870 | 880 | public ASTNode visitDoStatement(final DoStatementContext ctx) { |
871 | 881 | List<ExpressionSegment> expressions = new LinkedList<>(); |
|
0 commit comments