flycash commented on a change in pull request #13398:
URL: https://github.com/apache/shardingsphere/pull/13398#discussion_r741019521



##########
File path: 
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
##########
@@ -238,7 +243,57 @@ public ASTNode visitShowWarnings(final ShowWarningsContext 
ctx) {
     
     @Override
     public ASTNode visitResetStatement(final ResetStatementContext ctx) {
-        return new MySQLResetStatement();
+        MySQLStatementParser.ResetPersistContext persistContext = 
ctx.resetPersist();
+        if (persistContext != null) {

Review comment:
       done

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetOptionSegment.java
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.SQLSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NumberLiteralValue;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
+
+@Getter
+@Setter
+public class ResetOptionSegment implements SQLSegment {

Review comment:
       done

##########
File path: 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.reset;
+
+import lombok.Getter;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedSQLSegment;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+@Getter
+public class ExpectedResetOptionSegment extends AbstractExpectedSQLSegment {

Review comment:
       done

##########
File path: 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/reset.xml
##########
@@ -17,6 +17,32 @@
   -->
 
 <sql-parser-test-cases>
-    <common sql-case-id="reset_all" />
-    <common sql-case-id="reset_timezone" />
+    <common sql-case-id="reset_all"/>
+    <common sql-case-id="reset_timezone"/>
+    <reset sql-case-id="reset_master">
+        <option target="MASTER" start-index="6" stop-index="11"/>
+    </reset>
+    <reset sql-case-id="reset_slave">
+        <option target="SLAVE" start-index="6" stop-index="10"/>
+    </reset>
+    <reset sql-case-id="reset_master_slave">
+        <option target="MASTER" start-index="6" stop-index="11"/>
+        <option target="SLAVE" start-index="14" stop-index="18"/>
+    </reset>
+    <reset sql-case-id="reset_master_with_binlog">
+        <option target="MASTER" binary-log-file-index-number="10" 
start-index="6" stop-index="17"/>
+    </reset>
+    <reset sql-case-id="reset_slave_with_all">
+        <option target="SLAVE" all="ALL" start-index="6" stop-index="14"/>
+    </reset>
+    <reset sql-case-id="reset_slave_with_channel">
+        <option target="SLAVE" channel="TEST_CHANNEL" start-index="6" 
stop-index="37"/>
+    </reset>
+    <reset sql-case-id="reset_slave_with_all_channel">
+        <option target="SLAVE" all="ALL" channel="TEST_CHANNEL" 
start-index="6" stop-index="41"/>
+    </reset>
+

Review comment:
       done

##########
File path: 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/reset.xml
##########
@@ -19,4 +19,15 @@
 <sql-cases>
     <sql-case id="reset_all" value="RESET ALL"  
db-types="PostgreSQL,openGauss" />
     <sql-case id="reset_timezone" value="RESET timezone"  
db-types="PostgreSQL,openGauss" />
+    <sql-case id="reset_master" value="RESET MASTER" db-types="MySQL"/>
+    <sql-case id="reset_slave" value="RESET SLAVE" db-types="MySQL"/>
+    <sql-case id="reset_master_slave" value="RESET MASTER, SLAVE" 
db-types="MySQL"/>
+    <sql-case id="reset_master_with_binlog" value="RESET MASTER TO 10" 
db-types="MySQL"/>
+    <sql-case id="reset_slave_with_all" value="RESET SLAVE ALL" 
db-types="MySQL"/>
+    <sql-case id="reset_slave_with_channel" value="RESET SLAVE FOR CHANNEL 
'TEST_CHANNEL'" db-types="MySQL"/>
+    <sql-case id="reset_slave_with_all_channel" value="RESET SLAVE ALL FOR 
CHANNEL 'TEST_CHANNEL'" db-types="MySQL"/>
+

Review comment:
       done




-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to