strongduanmu commented on a change in pull request #10377:
URL: https://github.com/apache/shardingsphere/pull/10377#discussion_r634278568
##########
File path:
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLExplainStatement.java
##########
@@ -17,21 +17,29 @@
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal;
-import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import
org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
-import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.ExplainStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
+import java.util.Optional;
+
/**
- * MySQL describe statement.
+ * MySQL explain statement.
*/
-@Getter
@Setter
@ToString
-public final class MySQLDescribeStatement extends AbstractSQLStatement
implements DALStatement, MySQLStatement {
+public final class MySQLExplainStatement extends ExplainStatement implements
MySQLStatement {
private SimpleTableSegment table;
Review comment:
> This field will be removed `SQLStatement` later on, won't it?
@tristaZero In MySQL, explain also has the describe function. When explain
is used in this scenario, a `table` field will be parsed, so this field is
necessary.
You can refer to the explain grammar:
```
{EXPLAIN | DESCRIBE | DESC}
tbl_name [col_name | wild]
{EXPLAIN | DESCRIBE | DESC}
[explain_type]
{explainable_stmt | FOR CONNECTION connection_id}
{EXPLAIN | DESCRIBE | DESC} ANALYZE [FORMAT = TREE] select_statement
explain_type: {
FORMAT = format_name
}
format_name: {
TRADITIONAL
| JSON
| TREE
}
explainable_stmt: {
SELECT statement
| TABLE statement
| DELETE statement
| INSERT statement
| REPLACE statement
| UPDATE statement
}
```
--
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:
[email protected]