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

panjuan 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 8f9edd4  Add scaling distSQL:[STOP SCALING SOURCE WRITING jobId] & 
[SHOW SCALING CHECK ALGORITHMS] (#12670)
8f9edd4 is described below

commit 8f9edd4a3082d6caf925054733a0810dc0e0754a
Author: Raigor <[email protected]>
AuthorDate: Fri Sep 24 14:05:56 2021 +0800

    Add scaling distSQL:[STOP SCALING SOURCE WRITING jobId] & [SHOW SCALING 
CHECK ALGORITHMS] (#12670)
    
    * Add scaling distSQL:[STOP SCALING SOURCE WRITING jobId] & [SHOW SCALING 
CHECK ALGORITHMS]
    
    * Add test case for QueryResultSet.
---
 .../distsql/DistSQLBackendHandlerFactoryTest.java  | 33 ++++++++++
 .../ShowScalingCheckAlgorithmsQueryResultSet.java  | 72 ++++++++++++++++++++++
 .../handler/StopScalingSourceWritingUpdater.java}  | 52 ++++++----------
 ...dingsphere.infra.distsql.query.DistSQLResultSet |  1 +
 ....shardingsphere.infra.distsql.update.RALUpdater |  1 +
 ...owScalingCheckAlgorithmsQueryResultSetTest.java | 71 +++++++++++++++++++++
 .../src/main/antlr4/imports/scaling/Keyword.g4     | 12 ++++
 .../main/antlr4/imports/scaling/RALStatement.g4    |  8 +++
 .../distsql/parser/autogen/ScalingStatement.g4     |  2 +
 .../parser/core/ScalingSQLStatementVisitor.java    | 14 +++++
 .../ShowScalingCheckAlgorithmsStatement.java}      | 19 +++---
 .../StopScalingSourceWritingStatement.java}        | 25 ++++----
 .../ral/impl/QueryableRALStatementAssert.java      |  5 ++
 .../ral/impl/UpdatableRALStatementAssert.java      |  7 +++
 ...ShowScalingCheckAlgorithmsStatementAssert.java} | 31 ++++++----
 .../StopScalingSourceWritingStatementAssert.java   | 61 ++++++++++++++++++
 .../jaxb/cases/domain/SQLParserTestCases.java      | 10 +++
 ...howScalingCheckAlgorithmsStatementTestCase.java | 19 +++---
 .../StopScalingSourceWritingStatementTestCase.java | 49 +++++----------
 .../src/main/resources/case/ral/query.xml          |  1 +
 .../resources/case/ral/{query.xml => update.xml}   |  4 +-
 .../src/main/resources/sql/supported/ral/query.xml |  1 +
 .../sql/supported/ral/{query.xml => update.xml}    |  2 +-
 23 files changed, 384 insertions(+), 116 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
index f5a0b3c..75a8bcb 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
@@ -21,6 +21,7 @@ import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterResourc
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
+import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
 import 
org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import 
org.apache.shardingsphere.infra.distsql.exception.rule.RequiredRuleMissedException;
@@ -37,11 +38,16 @@ import 
org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
 import 
org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
 import 
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
+import 
org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandlerFactory;
 import 
org.apache.shardingsphere.proxy.backend.text.distsql.rdl.RDLBackendHandlerFactory;
 import 
org.apache.shardingsphere.proxy.backend.text.distsql.rql.RQLBackendHandlerFactory;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.AlterReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.CreateReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.DropReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.scaling.core.config.ScalingContext;
+import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement;
 import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
 import 
org.apache.shardingsphere.shadow.distsql.parser.statement.AlterShadowAlgorithmStatement;
 import 
org.apache.shardingsphere.shadow.distsql.parser.statement.AlterShadowRuleStatement;
@@ -249,6 +255,24 @@ public final class DistSQLBackendHandlerFactoryTest {
         assertThat(response, instanceOf(QueryResponseHeader.class));
     }
     
+    @Test
+    public void assertExecuteShowScalingCheckAlgorithmsContext() throws 
SQLException {
+        BackendConnection connection = mock(BackendConnection.class);
+        when(connection.getSchemaName()).thenReturn("schema");
+        mockScalingContext();
+        ResponseHeader response = 
RALBackendHandlerFactory.newInstance(mock(ShowScalingCheckAlgorithmsStatement.class),
 connection).execute();
+        assertThat(response, instanceOf(QueryResponseHeader.class));
+    }
+    
+    @Test
+    public void assertExecuteStopScalingSourceWritingContext() throws 
SQLException {
+        BackendConnection connection = mock(BackendConnection.class);
+        when(connection.getSchemaName()).thenReturn("schema");
+        mockScalingContext();
+        ResponseHeader response = 
RALBackendHandlerFactory.newInstance(mock(StopScalingSourceWritingStatement.class),
 connection).execute();
+        assertThat(response, instanceOf(UpdateResponseHeader.class));
+    }
+    
     private void setContextManager(final boolean isGovernance) {
         ContextManager contextManager = mock(ContextManager.class, 
RETURNS_DEEP_STUBS);
         MetaDataContexts metaDataContexts = isGovernance ? 
mockMetaDataContexts() : new 
MetaDataContexts(mock(MetaDataPersistService.class));
@@ -275,6 +299,15 @@ public final class DistSQLBackendHandlerFactoryTest {
         
when(ruleMetaData.getConfigurations()).thenReturn(Collections.singletonList(mock(ShadowRuleConfiguration.class)));
     }
     
+    private void mockScalingContext() {
+        ModeConfiguration modeConfiguration = mock(ModeConfiguration.class);
+        when(modeConfiguration.getType()).thenReturn("Cluster");
+        ServerConfiguration serverConfiguration = 
mock(ServerConfiguration.class);
+        
when(serverConfiguration.getModeConfiguration()).thenReturn(modeConfiguration);
+        when(serverConfiguration.getWorkerThread()).thenReturn(1);
+        ScalingContext.getInstance().init(serverConfiguration);
+    }
+    
     @After
     public void setDown() {
         setContextManager(false);
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSet.java
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSet.java
new file mode 100644
index 0000000..59894c5
--- /dev/null
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSet.java
@@ -0,0 +1,72 @@
+/*
+ * 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.scaling.distsql.handler;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.stream.Collectors;
+
+/**
+ * Show scaling check algorithms query result set.
+ */
+public final class ShowScalingCheckAlgorithmsQueryResultSet implements 
DistSQLResultSet {
+    
+    private Iterator<Collection<Object>> data;
+    
+    @Override
+    public void init(final ShardingSphereMetaData metaData, final SQLStatement 
sqlStatement) {
+        data = 
ScalingAPIFactory.getScalingAPI().listDataConsistencyCheckAlgorithms().stream()
+                .map(each -> {
+                    Collection<Object> list = new LinkedList<>();
+                    list.add(each.getType());
+                    list.add(each.getDescription());
+                    list.add((new 
Gson()).toJson(each.getSupportedDatabaseTypes()));
+                    list.add(each.getProvider());
+                    return list;
+                }).collect(Collectors.toList()).iterator();
+    }
+    
+    @Override
+    public Collection<String> getColumnNames() {
+        return Arrays.asList("type", "description", 
"supported_database_types", "provider");
+    }
+    
+    @Override
+    public boolean next() {
+        return data.hasNext();
+    }
+    
+    @Override
+    public Collection<Object> getRowData() {
+        return data.next();
+    }
+    
+    @Override
+    public String getType() {
+        return ShowScalingCheckAlgorithmsStatement.class.getCanonicalName();
+    }
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingSourceWritingUpdater.java
similarity index 50%
copy from 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
copy to 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingSourceWritingUpdater.java
index 2a5818f..3d90631 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingSourceWritingUpdater.java
@@ -15,38 +15,24 @@
  * limitations under the License.
  */
 
-grammar RALStatement;
+package org.apache.shardingsphere.scaling.distsql.handler;
 
-import Keyword, Literals, Symbol;
+import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
+import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
+import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement;
 
-showScalingJobList
-    : SHOW SCALING JOB LIST
-    ;
-
-showScalingJobStatus
-    : SHOW SCALING JOB STATUS jobId
-    ;
-
-startScalingJob
-    : START SCALING JOB jobId
-    ;
-
-stopScalingJob
-    : STOP SCALING JOB jobId
-    ;
-
-dropScalingJob
-    : DROP SCALING JOB jobId
-    ;
-
-resetScalingJob
-    : RESET SCALING JOB jobId
-    ;
-
-checkScalingJob
-    : CHECK SCALING JOB jobId
-    ;
-
-jobId
-    : INT
-    ;
+/**
+ * Stop scaling source writing updater.
+ */
+public final class StopScalingSourceWritingUpdater implements 
RALUpdater<StopScalingSourceWritingStatement> {
+    
+    @Override
+    public void executeUpdate(final StopScalingSourceWritingStatement 
sqlStatement) {
+        
ScalingAPIFactory.getScalingAPI().stopClusterWriteDB(sqlStatement.getJobId());
+    }
+    
+    @Override
+    public String getType() {
+        return StopScalingSourceWritingStatement.class.getCanonicalName();
+    }
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
index 4a4f1be..28745f3 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
@@ -18,3 +18,4 @@
 org.apache.shardingsphere.scaling.distsql.handler.CheckScalingJobQueryResultSet
 
org.apache.shardingsphere.scaling.distsql.handler.ShowScalingJobListQueryResultSet
 
org.apache.shardingsphere.scaling.distsql.handler.ShowScalingJobStatusQueryResultSet
+org.apache.shardingsphere.scaling.distsql.handler.ShowScalingCheckAlgorithmsQueryResultSet
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
index df452a4..4bd19f0 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
@@ -19,3 +19,4 @@ 
org.apache.shardingsphere.scaling.distsql.handler.StartScalingJobUpdater
 org.apache.shardingsphere.scaling.distsql.handler.StopScalingJobUpdater
 org.apache.shardingsphere.scaling.distsql.handler.ResetScalingJobUpdater
 org.apache.shardingsphere.scaling.distsql.handler.DropScalingJobUpdater
+org.apache.shardingsphere.scaling.distsql.handler.StopScalingSourceWritingUpdater
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/test/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSetTest.java
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/test/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSetTest.java
new file mode 100644
index 0000000..ad4e623
--- /dev/null
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/test/java/org/apache/shardingsphere/scaling/distsql/handler/ShowScalingCheckAlgorithmsQueryResultSetTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.scaling.distsql.handler;
+
+import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.scaling.core.config.ScalingContext;
+import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShowScalingCheckAlgorithmsQueryResultSetTest {
+    
+    @Mock
+    private ShardingSphereMetaData shardingSphereMetaData;
+    
+    @Mock
+    private ShowScalingCheckAlgorithmsStatement 
showScalingCheckAlgorithmsStatement;
+    
+    @Before
+    public void before() {
+        ModeConfiguration modeConfiguration = mock(ModeConfiguration.class);
+        when(modeConfiguration.getType()).thenReturn("Cluster");
+        ServerConfiguration serverConfiguration = 
mock(ServerConfiguration.class);
+        
when(serverConfiguration.getModeConfiguration()).thenReturn(modeConfiguration);
+        when(serverConfiguration.getWorkerThread()).thenReturn(1);
+        ScalingContext.getInstance().init(serverConfiguration);
+    }
+    
+    @Test
+    public void assertGetRowData() {
+        DistSQLResultSet resultSet = new 
ShowScalingCheckAlgorithmsQueryResultSet();
+        resultSet.init(shardingSphereMetaData, 
showScalingCheckAlgorithmsStatement);
+        Collection<Object> actual = resultSet.getRowData();
+        assertThat(actual.size(), is(4));
+        Iterator<Object> rowData = actual.iterator();
+        assertThat(rowData.next(), is("DEFAULT"));
+        assertThat(rowData.next(), is("Default implementation with CRC32 of 
all records."));
+        assertThat(rowData.next(), is("[\"MySQL\",\"PostgreSQL\"]"));
+        assertThat(rowData.next(), is("ShardingSphere"));
+    }
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/Keyword.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/Keyword.g4
index 571dbc7..0b7cd12 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/Keyword.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/Keyword.g4
@@ -23,6 +23,10 @@ WS
     : [ \t\r\n] + ->skip
     ;
 
+ALGORITHMS
+    : A L G O R I T H M S
+    ;
+
 DROP
     : D R O P
     ;
@@ -62,3 +66,11 @@ LIST
 STATUS
     : S T A T U S
     ;
+
+SOURCE
+    : S O U R C E
+    ;
+
+WRITING
+    : W R I T I N G
+    ;
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
index 2a5818f..2c428ed 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
@@ -47,6 +47,14 @@ checkScalingJob
     : CHECK SCALING JOB jobId
     ;
 
+showScalingCheckAlgorithms
+    : SHOW SCALING CHECK ALGORITHMS
+    ;
+
+stopScalingSourceWriting
+    : STOP SCALING SOURCE WRITING jobId
+    ;
+
 jobId
     : INT
     ;
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
index fda5039..2909d57 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
@@ -27,5 +27,7 @@ execute
     | dropScalingJob
     | resetScalingJob
     | checkScalingJob
+    | showScalingCheckAlgorithms
+    | stopScalingSourceWriting
     ) SEMI?
     ;
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
index 4f888ca..f46ce9a 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
@@ -21,17 +21,21 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementBaseVisi
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.CheckScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.DropScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ResetScalingJobContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingCheckAlgorithmsContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingJobListContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingJobStatusContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StartScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StopScalingJobContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StopScalingSourceWritingContext;
 import 
org.apache.shardingsphere.scaling.distsql.statement.CheckScalingJobStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.DropScalingJobStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.ResetScalingJobStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingJobListStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingJobStatusStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.StartScalingJobStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingJobStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 
@@ -74,4 +78,14 @@ public final class ScalingSQLStatementVisitor extends 
ScalingStatementBaseVisito
     public ASTNode visitCheckScalingJob(final CheckScalingJobContext ctx) {
         return new 
CheckScalingJobStatement(Long.parseLong(ctx.jobId().getText()));
     }
+    
+    @Override
+    public ASTNode visitShowScalingCheckAlgorithms(final 
ShowScalingCheckAlgorithmsContext ctx) {
+        return new ShowScalingCheckAlgorithmsStatement();
+    }
+    
+    @Override
+    public ASTNode visitStopScalingSourceWriting(final 
StopScalingSourceWritingContext ctx) {
+        return new 
StopScalingSourceWritingStatement(Long.parseLong(ctx.jobId().getText()));
+    }
 }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/ShowScalingCheckAlgorithmsStatement.java
similarity index 73%
copy from 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
copy to 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/ShowScalingCheckAlgorithmsStatement.java
index fda5039..a34ea10 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/ShowScalingCheckAlgorithmsStatement.java
@@ -15,17 +15,12 @@
  * limitations under the License.
  */
 
-grammar ScalingStatement;
+package org.apache.shardingsphere.scaling.distsql.statement;
 
-import Symbol, RALStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
 
-execute
-    : (showScalingJobList
-    | showScalingJobStatus
-    | startScalingJob
-    | stopScalingJob
-    | dropScalingJob
-    | resetScalingJob
-    | checkScalingJob
-    ) SEMI?
-    ;
+/**
+ * Show scaling check algorithms statement.
+ */
+public final class ShowScalingCheckAlgorithmsStatement extends 
QueryableRALStatement {
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/StopScalingSourceWritingStatement.java
similarity index 66%
copy from 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
copy to 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/StopScalingSourceWritingStatement.java
index fda5039..70479be 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/StopScalingSourceWritingStatement.java
@@ -15,17 +15,18 @@
  * limitations under the License.
  */
 
-grammar ScalingStatement;
+package org.apache.shardingsphere.scaling.distsql.statement;
 
-import Symbol, RALStatement;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement;
 
-execute
-    : (showScalingJobList
-    | showScalingJobStatus
-    | startScalingJob
-    | stopScalingJob
-    | dropScalingJob
-    | resetScalingJob
-    | checkScalingJob
-    ) SEMI?
-    ;
+/**
+ * Stop scaling source writing statement.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class StopScalingSourceWritingStatement extends 
UpdatableRALStatement {
+    
+    private final long jobId;
+}
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
index e53a579..ef1ad90 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
@@ -20,10 +20,13 @@ package 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statemen
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingJobListStatement;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.query.ShowScalingCheckAlgorithmsStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.query.ShowScalingJobListStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.ShowScalingCheckAlgorithmsStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowScalingJobListStatementTestCase;
 
 /**
@@ -43,6 +46,8 @@ public final class QueryableRALStatementAssert {
         // TODO add more test case
         if (actual instanceof ShowScalingJobListStatement) {
             ShowScalingJobListStatementAssert.assertIs(assertContext, 
(ShowScalingJobListStatement) actual, (ShowScalingJobListStatementTestCase) 
expected);
+        } else if (actual instanceof ShowScalingCheckAlgorithmsStatement) {
+            ShowScalingCheckAlgorithmsStatementAssert.assertIs(assertContext, 
(ShowScalingCheckAlgorithmsStatement) actual, 
(ShowScalingCheckAlgorithmsStatementTestCase) expected);
         }
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
index 0d0bd07..0d3dbfd 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
@@ -20,8 +20,11 @@ package 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statemen
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.update.StopScalingSourceWritingStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.StopScalingSourceWritingStatementTestCase;
 
 /**
  * Updatable RAL statement assert.
@@ -37,5 +40,9 @@ public final class UpdatableRALStatementAssert {
      * @param expected expected updatable RAL statement test case
      */
     public static void assertIs(final SQLCaseAssertContext assertContext, 
final UpdatableRALStatement actual, final SQLParserTestCase expected) {
+        // TODO add more test case
+        if (actual instanceof StopScalingSourceWritingStatement) {
+            StopScalingSourceWritingStatementAssert.assertIs(assertContext, 
(StopScalingSourceWritingStatement) actual, 
(StopScalingSourceWritingStatementTestCase) expected);
+        }
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/query/ShowScalingCheckAlgorithmsStatementAssert.java
similarity index 52%
copy from 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/query/ShowScalingCheckAlgorithmsStatementAssert.java
index 0d0bd07..a6e0953 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/query/ShowScalingCheckAlgorithmsStatementAssert.java
@@ -15,27 +15,32 @@
  * limitations under the License.
  */
 
-package 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl;
+package 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.query;
 
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement;
+import 
org.apache.shardingsphere.scaling.distsql.statement.ShowScalingCheckAlgorithmsStatement;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.ShowScalingCheckAlgorithmsStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 /**
- * Updatable RAL statement assert.
+ * Show scaling check algorithms statement assert.
  */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class UpdatableRALStatementAssert {
-
+public final class ShowScalingCheckAlgorithmsStatementAssert {
+    
     /**
-     * Assert updatable RAL statement is correct with expected parser result.
+     * Assert show scaling check algorithms statement is correct with expected 
parser result.
      *
      * @param assertContext assert context
-     * @param actual actual updatable RAL statement
-     * @param expected expected updatable RAL statement test case
+     * @param actual actual show scaling check algorithms statement
+     * @param expected expected show scaling check algorithms statement test 
case
      */
-    public static void assertIs(final SQLCaseAssertContext assertContext, 
final UpdatableRALStatement actual, final SQLParserTestCase expected) {
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final ShowScalingCheckAlgorithmsStatement actual, final 
ShowScalingCheckAlgorithmsStatementTestCase expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should 
exist."), actual);
+        }
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/update/StopScalingSourceWritingStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/update/StopScalingSourceWritingStatementAssert.java
new file mode 100644
index 0000000..daab91f
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/update/StopScalingSourceWritingStatementAssert.java
@@ -0,0 +1,61 @@
+/*
+ * 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.asserts.statement.distsql.ral.impl.update;
+
+import org.apache.commons.collections4.CollectionUtils;
+import 
org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.StopScalingSourceWritingStatementTestCase;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Stop scaling source writing statement assert.
+ */
+public final class StopScalingSourceWritingStatementAssert {
+    
+    /**
+     * Assert stop scaling source writing statement is correct with expected 
parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual stop scaling source writing statement
+     * @param expected expected stop scaling source writing statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final StopScalingSourceWritingStatement actual, final 
StopScalingSourceWritingStatementTestCase expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should 
exist."), actual);
+            assertJobIds(assertContext, actual.getJobId(), 
expected.getJobIds());
+        }
+    }
+    
+    private static void assertJobIds(final SQLCaseAssertContext assertContext, 
final long actual, final List<Long> expected) {
+        if (CollectionUtils.isEmpty(expected)) {
+            assertNull(assertContext.getText("Actual job id should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual job id should 
exist."), actual);
+            assertThat(assertContext.getText("job id assertion error"), 
actual, is(expected.iterator().next().longValue()));
+        }
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index 1b7a732..777839b 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -96,9 +96,11 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.SetShardingHintDatabaseValueStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.SetVariableStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingHintStatusStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.ShowScalingCheckAlgorithmsStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowScalingJobListStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowShardingHintStatusStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowVariableStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.StopScalingSourceWritingStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterDataBaseDiscoveryRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterEncryptRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterReadWriteSplittingRuleStatementTestCase;
@@ -496,6 +498,12 @@ public final class SQLParserTestCases {
     @XmlElement(name = "show-scaling-job-list")
     private final List<ShowScalingJobListStatementTestCase> 
showScalingJobListStatementTestCase = new LinkedList<>();
     
+    @XmlElement(name = "show-scaling-check-algorithms")
+    private final List<ShowScalingCheckAlgorithmsStatementTestCase> 
showScalingCheckAlgorithmsStatementTestCase = new LinkedList<>();
+    
+    @XmlElement(name = "stop-scaling-source-writing")
+    private final List<StopScalingSourceWritingStatementTestCase> 
stopScalingSourceWritingStatementTestCase = new LinkedList<>();
+    
     @XmlElement(name = "preview-sql")
     private final List<PreviewStatementTestCase> previewStatementTestCase = 
new LinkedList<>();
     
@@ -673,6 +681,8 @@ public final class SQLParserTestCases {
         putAll(showShardingTableRulesTestCase, result);
         putAll(showShardingTableRuleTestCase, result);
         putAll(showScalingJobListStatementTestCase, result);
+        putAll(showScalingCheckAlgorithmsStatementTestCase, result);
+        putAll(stopScalingSourceWritingStatementTestCase, result);
         putAll(showVariableStatementTestCase, result);
         putAll(setVariableStatementTestCase, result);
         putAll(previewStatementTestCase, result);
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/ShowScalingCheckAlgorithmsStatementTestCase.java
similarity index 68%
copy from 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/ShowScalingCheckAlgorithmsStatementTestCase.java
index fda5039..552e83a 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/ShowScalingCheckAlgorithmsStatementTestCase.java
@@ -15,17 +15,12 @@
  * limitations under the License.
  */
 
-grammar ScalingStatement;
+package 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling;
 
-import Symbol, RALStatement;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 
-execute
-    : (showScalingJobList
-    | showScalingJobStatus
-    | startScalingJob
-    | stopScalingJob
-    | dropScalingJob
-    | resetScalingJob
-    | checkScalingJob
-    ) SEMI?
-    ;
+/**
+ * Show scaling check algorithms statement test case.
+ */
+public final class ShowScalingCheckAlgorithmsStatementTestCase extends 
SQLParserTestCase {
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/StopScalingSourceWritingStatementTestCase.java
similarity index 56%
copy from 
shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/StopScalingSourceWritingStatementTestCase.java
index 2a5818f..f11a884 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/scaling/StopScalingSourceWritingStatementTestCase.java
@@ -15,38 +15,23 @@
  * limitations under the License.
  */
 
-grammar RALStatement;
+package 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling;
 
-import Keyword, Literals, Symbol;
+import lombok.Getter;
+import lombok.Setter;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 
-showScalingJobList
-    : SHOW SCALING JOB LIST
-    ;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.LinkedList;
+import java.util.List;
 
-showScalingJobStatus
-    : SHOW SCALING JOB STATUS jobId
-    ;
-
-startScalingJob
-    : START SCALING JOB jobId
-    ;
-
-stopScalingJob
-    : STOP SCALING JOB jobId
-    ;
-
-dropScalingJob
-    : DROP SCALING JOB jobId
-    ;
-
-resetScalingJob
-    : RESET SCALING JOB jobId
-    ;
-
-checkScalingJob
-    : CHECK SCALING JOB jobId
-    ;
-
-jobId
-    : INT
-    ;
+/**
+ * Stop scaling source writing statement test case.
+ */
+@Getter
+@Setter
+public final class StopScalingSourceWritingStatementTestCase extends 
SQLParserTestCase {
+    
+    @XmlElement(name = "job-id")
+    private final List<Long> jobIds = new LinkedList<>();
+}
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
index 95a6bb2..31db2b9 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
@@ -18,4 +18,5 @@
 
 <sql-parser-test-cases>
     <show-scaling-job-list sql-case-id="show-scaling-job-list" />
+    <show-scaling-check-algorithms sql-case-id="show-scaling-check-algorithms" 
/>
 </sql-parser-test-cases>
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/update.xml
similarity index 86%
copy from 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/update.xml
index 95a6bb2..5b628bd 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/query.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/update.xml
@@ -17,5 +17,7 @@
   -->
 
 <sql-parser-test-cases>
-    <show-scaling-job-list sql-case-id="show-scaling-job-list" />
+    <stop-scaling-source-writing sql-case-id="stop-scaling-source-writing">
+        <job-id>123</job-id>
+    </stop-scaling-source-writing>
 </sql-parser-test-cases>
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
index f31e35d..2523cec 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
@@ -18,4 +18,5 @@
 
 <sql-cases>
     <distsql-case id="show-scaling-job-list" value="SHOW SCALING JOB LIST;" />
+    <distsql-case id="show-scaling-check-algorithms" value="SHOW SCALING CHECK 
ALGORITHMS;" />
 </sql-cases>
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/update.xml
similarity index 90%
copy from 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/update.xml
index f31e35d..b7647da 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/query.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/update.xml
@@ -17,5 +17,5 @@
   -->
 
 <sql-cases>
-    <distsql-case id="show-scaling-job-list" value="SHOW SCALING JOB LIST;" />
+    <distsql-case id="stop-scaling-source-writing" value="STOP SCALING SOURCE 
WRITING 123;" />
 </sql-cases>

Reply via email to