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

jianglongtao 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 450c2d2ea2e Refactor parameter type definitions of Scaling DistSQL. 
(#20082)
450c2d2ea2e is described below

commit 450c2d2ea2e9859da544b18e713b2bb4210aa891
Author: yx9o <[email protected]>
AuthorDate: Thu Aug 11 20:52:51 2022 +0800

    Refactor parameter type definitions of Scaling DistSQL. (#20082)
    
    * Refactor parameter type definitions of Scaling DistSQL.
    
    * Fix scaling-it-test.
    
    * Fix scaling-it-test.
---
 .../src/main/antlr4/imports/scaling/BaseRule.g4    |  4 +-
 .../src/main/antlr4/imports/scaling/Literals.g4    | 21 +----
 .../main/antlr4/imports/scaling/RALStatement.g4    |  2 +-
 ...lingStatement.g4 => ScalingDistSQLStatement.g4} |  2 +-
 ...{ScalingLexer.java => ScalingDistSQLLexer.java} |  8 +-
 ...calingParser.java => ScalingDistSQLParser.java} |  8 +-
 ...or.java => ScalingDistSQLStatementVisitor.java} | 94 ++++++++++------------
 .../ScalingDistSQLStatementParserFacade.java       | 12 +--
 .../data/pipeline/cases/base/BaseITCase.java       | 16 ++--
 .../main/resources/sql/supported/ral/scaling.xml   |  2 +-
 .../main/resources/sql/supported/rdl/create.xml    |  6 +-
 11 files changed, 74 insertions(+), 101 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/BaseRule.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/BaseRule.g4
index 3efe5b6195c..837682305d6 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/BaseRule.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/BaseRule.g4
@@ -24,7 +24,7 @@ algorithmDefinition
     ;
 
 algorithmName
-    : IDENTIFIER
+    : STRING
     ;
 
 algorithmProperties
@@ -32,5 +32,5 @@ algorithmProperties
     ;
 
 algorithmProperty
-    : key=(IDENTIFIER | STRING) EQ value=(INT | IDENTIFIER | STRING)
+    : key=STRING EQ value=STRING
     ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/Literals.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/Literals.g4
index e5f807b1104..07557015093 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/Literals.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/Literals.g4
@@ -22,30 +22,13 @@ import Alphabet, Symbol;
 IDENTIFIER
     : [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*
     | BQ ~'`'+ BQ
-    | (DQ ( '\\'. | '""' | ~('"'| '\\') )* DQ)
     ;
     
 STRING
-    : (DQ ('""' | ~('"'| '\\') )* DQ)
-    | (SQ ('\'\'' | ~('\'' | '\\'))* SQ)
+    : (DQ ('\\'. | '""' | ~('"' | '\\'))* DQ)
+    | (SQ ('\\'. | '\'\'' | ~('\'' | '\\'))* SQ)
     ;
 
 INT
     : [0-9]+
     ;
-
-HEX
-    : [0-9a-fA-F]
-    ;
-
-NUMBER
-    : INT? DOT? INT (E (PLUS | MINUS)? INT)?
-    ;
-
-HEXDIGIT
-    : '0x' HEX+ | 'X' SQ HEX+ SQ
-    ;
-    
-BITNUM
-    : '0b' ('0' | '1')+ | B SQ ('0' | '1')+ SQ
-    ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
index 59c405f576f..908ec98e6dd 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RALStatement.g4
@@ -64,5 +64,5 @@ applyScaling
     ;
 
 jobId
-    : INT | IDENTIFIER
+    : INT | STRING
     ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingDistSQLStatement.g4
similarity index 97%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
rename to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingDistSQLStatement.g4
index ff74c2bed61..c87ec85e005 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/scaling/org/apache/shardingsphere/distsql/parser/autogen/ScalingDistSQLStatement.g4
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-grammar ScalingStatement;
+grammar ScalingDistSQLStatement;
 
 import Symbol, RALStatement, RDLStatement, RQLStatement;
 
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingLexer.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLLexer.java
similarity index 78%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingLexer.java
rename to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLLexer.java
index 07078be0fb7..20b53e0b73b 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingLexer.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLLexer.java
@@ -18,15 +18,15 @@
 package org.apache.shardingsphere.scaling.distsql.parser.core;
 
 import org.antlr.v4.runtime.CharStream;
-import org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementLexer;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 
 /**
- * SQL lexer for scaling.
+ * SQL lexer for scaling dist SQL.
  */
-public final class ScalingLexer extends ScalingStatementLexer implements 
SQLLexer {
+public final class ScalingDistSQLLexer extends ScalingDistSQLStatementLexer 
implements SQLLexer {
     
-    public ScalingLexer(final CharStream input) {
+    public ScalingDistSQLLexer(final CharStream input) {
         super(input);
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingParser.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLParser.java
similarity index 82%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingParser.java
rename to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLParser.java
index 14961c51b9f..2cf86ec8b37 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingParser.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLParser.java
@@ -19,17 +19,17 @@ package 
org.apache.shardingsphere.scaling.distsql.parser.core;
 
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.antlr.v4.runtime.TokenStream;
-import org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
 import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
 
 /**
- * SQL parser for scaling.
+ * SQL parser for scaling dist SQL.
  */
-public final class ScalingParser extends ScalingStatementParser implements 
SQLParser {
+public final class ScalingDistSQLParser extends ScalingDistSQLStatementParser 
implements SQLParser {
     
-    public ScalingParser(final TokenStream input) {
+    public ScalingDistSQLParser(final TokenStream input) {
         super(input);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLStatementVisitor.java
similarity index 68%
rename from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
rename to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLStatementVisitor.java
index a8f3d68a17b..f469702d4ee 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingDistSQLStatementVisitor.java
@@ -18,36 +18,36 @@
 package org.apache.shardingsphere.scaling.distsql.parser.core;
 
 import org.antlr.v4.runtime.tree.ParseTree;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementBaseVisitor;
-import org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.AlgorithmDefinitionContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ApplyScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.BatchSizeContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.CheckScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.CompletionDetectorContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.CreateShardingScalingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.DataConsistencyCheckerContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.DisableShardingScalingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.DropScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.DropShardingScalingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.EnableShardingScalingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.InputDefinitionContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.OutputDefinitionContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.RateLimiterContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ResetScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.RestoreScalingSourceWritingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ScalingRuleDefinitionContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.SchemaNameContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShardingSizeContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingCheckAlgorithmsContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingListContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowScalingStatusContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.ShowShardingScalingRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StartScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StopScalingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StopScalingSourceWritingContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.StreamChannelContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingStatementParser.WorkerThreadContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementBaseVisitor;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.AlgorithmDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ApplyScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.BatchSizeContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.CheckScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.CompletionDetectorContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.CreateShardingScalingRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.DataConsistencyCheckerContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.DisableShardingScalingRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.DropScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.DropShardingScalingRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.EnableShardingScalingRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.InputDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.OutputDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.RateLimiterContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ResetScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.RestoreScalingSourceWritingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ScalingRuleDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.SchemaNameContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ShardingSizeContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ShowScalingCheckAlgorithmsContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ShowScalingListContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ShowScalingStatusContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.ShowShardingScalingRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.StartScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.StopScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.StopScalingSourceWritingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.StreamChannelContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ScalingDistSQLStatementParser.WorkerThreadContext;
 import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
 import 
org.apache.shardingsphere.scaling.distsql.statement.ApplyScalingStatement;
 import 
org.apache.shardingsphere.scaling.distsql.statement.CheckScalingStatement;
@@ -75,9 +75,9 @@ import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
 import java.util.Properties;
 
 /**
- * SQL statement visitor for scaling.
+ * SQL statement visitor for scaling dist SQL.
  */
-public final class ScalingSQLStatementVisitor extends 
ScalingStatementBaseVisitor<ASTNode> implements SQLVisitor {
+public final class ScalingDistSQLStatementVisitor extends 
ScalingDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
     
     @Override
     public ASTNode visitShowScalingList(final ShowScalingListContext ctx) {
@@ -111,11 +111,7 @@ public final class ScalingSQLStatementVisitor extends 
ScalingStatementBaseVisito
     
     @Override
     public ASTNode visitCheckScaling(final CheckScalingContext ctx) {
-        AlgorithmSegment typeStrategy = null;
-        if (null != ctx.algorithmDefinition()) {
-            typeStrategy = (AlgorithmSegment) visit(ctx.algorithmDefinition());
-        }
-        return new CheckScalingStatement(getIdentifierValue(ctx.jobId()), 
typeStrategy);
+        return new CheckScalingStatement(getIdentifierValue(ctx.jobId()), null 
== ctx.algorithmDefinition() ? null : (AlgorithmSegment) 
visit(ctx.algorithmDefinition()));
     }
     
     @Override
@@ -167,25 +163,19 @@ public final class ScalingSQLStatementVisitor extends 
ScalingStatementBaseVisito
     
     @Override
     public ASTNode visitInputDefinition(final InputDefinitionContext ctx) {
-        Integer workerThread = getWorkerThread(ctx.workerThread());
-        Integer batchSize = getBatchSize(ctx.batchSize());
-        Integer shardingSize = getShardingSize(ctx.shardingSize());
-        AlgorithmSegment rateLimiter = null;
-        if (null != ctx.rateLimiter()) {
-            rateLimiter = (AlgorithmSegment) visit(ctx.rateLimiter());
-        }
-        return new InputOrOutputSegment(workerThread, batchSize, shardingSize, 
rateLimiter);
+        return new InputOrOutputSegment(getWorkerThread(ctx.workerThread()), 
getBatchSize(ctx.batchSize()), getShardingSize(ctx.shardingSize()), 
getAlgorithmSegment(ctx.rateLimiter()));
     }
     
     @Override
     public ASTNode visitOutputDefinition(final OutputDefinitionContext ctx) {
-        Integer workerThread = getWorkerThread(ctx.workerThread());
-        Integer batchSize = getBatchSize(ctx.batchSize());
-        AlgorithmSegment rateLimiter = null;
-        if (null != ctx.rateLimiter()) {
-            rateLimiter = (AlgorithmSegment) visit(ctx.rateLimiter());
+        return new InputOrOutputSegment(getWorkerThread(ctx.workerThread()), 
getBatchSize(ctx.batchSize()), getAlgorithmSegment(ctx.rateLimiter()));
+    }
+    
+    private AlgorithmSegment getAlgorithmSegment(final RateLimiterContext ctx) 
{
+        if (null == ctx) {
+            return null;
         }
-        return new InputOrOutputSegment(workerThread, batchSize, rateLimiter);
+        return (AlgorithmSegment) visit(ctx);
     }
     
     private Integer getWorkerThread(final WorkerThreadContext ctx) {
@@ -259,7 +249,7 @@ public final class ScalingSQLStatementVisitor extends 
ScalingStatementBaseVisito
         if (null == ctx.algorithmProperties()) {
             return result;
         }
-        for (ScalingStatementParser.AlgorithmPropertyContext each : 
ctx.algorithmProperties().algorithmProperty()) {
+        for (ScalingDistSQLStatementParser.AlgorithmPropertyContext each : 
ctx.algorithmProperties().algorithmProperty()) {
             
result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), 
IdentifierValue.getQuotedContent(each.value.getText()));
         }
         return result;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/facade/ScalingDistSQLStatementParserFacade.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/facade/ScalingDistSQLStatementParserFacade.java
index 546f799e88d..9673611332d 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/facade/ScalingDistSQLStatementParserFacade.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/facade/ScalingDistSQLStatementParserFacade.java
@@ -18,9 +18,9 @@
 package org.apache.shardingsphere.scaling.distsql.parser.facade;
 
 import 
org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade;
-import org.apache.shardingsphere.scaling.distsql.parser.core.ScalingLexer;
-import org.apache.shardingsphere.scaling.distsql.parser.core.ScalingParser;
-import 
org.apache.shardingsphere.scaling.distsql.parser.core.ScalingSQLStatementVisitor;
+import 
org.apache.shardingsphere.scaling.distsql.parser.core.ScalingDistSQLLexer;
+import 
org.apache.shardingsphere.scaling.distsql.parser.core.ScalingDistSQLParser;
+import 
org.apache.shardingsphere.scaling.distsql.parser.core.ScalingDistSQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
@@ -32,17 +32,17 @@ public final class ScalingDistSQLStatementParserFacade 
implements FeaturedDistSQ
     
     @Override
     public Class<? extends SQLLexer> getLexerClass() {
-        return ScalingLexer.class;
+        return ScalingDistSQLLexer.class;
     }
     
     @Override
     public Class<? extends SQLParser> getParserClass() {
-        return ScalingParser.class;
+        return ScalingDistSQLParser.class;
     }
     
     @Override
     public Class<? extends SQLVisitor> getVisitorClass() {
-        return ScalingSQLStatementVisitor.class;
+        return ScalingDistSQLStatementVisitor.class;
     }
     
     @Override
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index 3fddc3ca0c0..7346aa0e655 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -257,13 +257,13 @@ public abstract class BaseITCase {
                 List<Map<String, Object>> scalingList = 
jdbcTemplate.queryForList("SHOW SCALING LIST");
                 for (Map<String, Object> each : scalingList) {
                     String id = each.get("id").toString();
-                    executeWithLog(String.format("DROP SCALING %s", id), 0);
+                    executeWithLog(String.format("DROP SCALING '%s'", id), 0);
                 }
             } catch (final DataAccessException ex) {
                 log.error("Failed to show scaling list. {}", ex.getMessage());
             }
         }
-        executeWithLog("CREATE SHARDING SCALING RULE scaling_manual 
(INPUT(SHARDING_SIZE=1000), DATA_CONSISTENCY_CHECKER(TYPE(NAME=DATA_MATCH)))");
+        executeWithLog("CREATE SHARDING SCALING RULE scaling_manual 
(INPUT(SHARDING_SIZE=1000), 
DATA_CONSISTENCY_CHECKER(TYPE(NAME='DATA_MATCH')))");
     }
     
     protected void createSchema(final String schemaName) {
@@ -321,20 +321,20 @@ public abstract class BaseITCase {
     }
     
     protected void stopScalingSourceWriting(final String jobId) {
-        executeWithLog(String.format("STOP SCALING SOURCE WRITING %s", jobId));
+        executeWithLog(String.format("STOP SCALING SOURCE WRITING '%s'", 
jobId));
     }
     
     protected void stopScaling(final String jobId) {
-        executeWithLog(String.format("STOP SCALING %s", jobId), 5);
+        executeWithLog(String.format("STOP SCALING '%s'", jobId), 5);
     }
     
     protected void startScaling(final String jobId) {
-        executeWithLog(String.format("START SCALING %s", jobId), 10);
+        executeWithLog(String.format("START SCALING '%s'", jobId), 10);
     }
     
     protected void applyScaling(final String jobId) {
         assertBeforeApplyScalingMetadataCorrectly();
-        executeWithLog(String.format("APPLY SCALING %s", jobId));
+        executeWithLog(String.format("APPLY SCALING '%s'", jobId));
     }
     
     protected void assertBeforeApplyScalingMetadataCorrectly() {
@@ -379,7 +379,7 @@ public abstract class BaseITCase {
     }
     
     protected List<Map<String, Object>> showScalingStatus(final String jobId) {
-        return queryForListWithLog(String.format("SHOW SCALING STATUS %s", 
jobId));
+        return queryForListWithLog(String.format("SHOW SCALING STATUS '%s'", 
jobId));
     }
     
     protected void assertCheckScalingSuccess(final String jobId) {
@@ -392,7 +392,7 @@ public abstract class BaseITCase {
         boolean secondCheckJobResult = checkJobIncrementTaskFinished(jobId);
         log.info("second check job result: {}", secondCheckJobResult);
         stopScalingSourceWriting(jobId);
-        List<Map<String, Object>> checkScalingResults = 
queryForListWithLog(String.format("CHECK SCALING %s BY TYPE (NAME=DATA_MATCH)", 
jobId));
+        List<Map<String, Object>> checkScalingResults = 
queryForListWithLog(String.format("CHECK SCALING '%s' BY TYPE 
(NAME='DATA_MATCH')", jobId));
         log.info("checkScalingResults: {}", checkScalingResults);
         for (Map<String, Object> entry : checkScalingResults) {
             
assertTrue(Boolean.parseBoolean(entry.get("records_content_matched").toString()));
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/scaling.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/scaling.xml
index b5c2f151b35..3b32ecd19d7 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/scaling.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/scaling.xml
@@ -21,7 +21,7 @@
     <distsql-case id="show-scaling-check-algorithms" value="SHOW SCALING CHECK 
ALGORITHMS;" />
     <distsql-case id="check-scaling" value="CHECK SCALING 123;" />
     <distsql-case id="show-scaling-status" value="SHOW SCALING STATUS 123;" />
-    <distsql-case id="check-scaling-with-type" value="CHECK SCALING 123 by 
TYPE(name=DEFAULT, PROPERTIES('test-property'=4));" />
+    <distsql-case id="check-scaling-with-type" value="CHECK SCALING 123 by 
TYPE(name='DEFAULT', PROPERTIES('test-property'='4'));" />
     
     <distsql-case id="stop-scaling-source-writing" value="STOP SCALING SOURCE 
WRITING 123;" />
     <distsql-case id="restore-scaling-source-writing" value="RESTORE SCALING 
SOURCE WRITING 123;" />
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
index 8239a03a6f3..e6164e73922 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
@@ -63,7 +63,7 @@
     <distsql-case id="create-sharding-key-generator" value="CREATE SHARDING 
KEY GENERATOR uuid_key_generator(TYPE(NAME=uuid))" />
     <distsql-case id="create-sharding-auditor" value="CREATE SHARDING AUDITOR 
sharding_key_required_auditor(TYPE(NAME=DML_SHARDING_CONDITIONS))" />
     <distsql-case id="create-sharding-scaling-rule-without-configuration" 
value="CREATE SHARDING SCALING RULE default_scaling" />
-    <distsql-case 
id="create-sharding-scaling-rule-with-minimal-auto-configuration" value="CREATE 
SHARDING SCALING RULE default_scaling (COMPLETION_DETECTOR 
(TYPE(NAME=IDLE,PROPERTIES('incremental-task-idle-seconds-threshold'=1800))),DATA_CONSISTENCY_CHECKER
 (TYPE(NAME=DATA_MATCH,PROPERTIES ('chunk-size'=1000))))" />
-    <distsql-case 
id="create-sharding-scaling-rule-with-complete-auto-configuration" 
value="CREATE SHARDING SCALING RULE default_scaling (INPUT 
(WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE(NAME=QPS,PROPERTIES 
('qps'=50)))),OUTPUT (WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER 
(TYPE(NAME=TPS,PROPERTIES ('tps'=2000)))),STREAM_CHANNEL (TYPE 
(NAME=MEMORY,PROPERTIES ('block-queue-size'=10000))),COMPLETION_DETECTOR (TYPE 
(NAME=IDLE,PROPERTIES ('incremental-task-idle-seconds-threshold'= [...]
-    <distsql-case id="create-sharding-scaling-rule-with-manual-configuration" 
value="CREATE SHARDING SCALING RULE default_scaling (INPUT 
(WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE(NAME=QPS,PROPERTIES 
('qps'=50)))),OUTPUT (WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE 
(NAME=TPS,PROPERTIES ('tps'=2000)))),STREAM_CHANNEL (TYPE 
(NAME=MEMORY,PROPERTIES ('block-queue-size'=10000))))" />
+    <distsql-case 
id="create-sharding-scaling-rule-with-minimal-auto-configuration" value="CREATE 
SHARDING SCALING RULE default_scaling (COMPLETION_DETECTOR 
(TYPE(NAME='IDLE',PROPERTIES('incremental-task-idle-seconds-threshold'='1800'))),DATA_CONSISTENCY_CHECKER
 (TYPE(NAME='DATA_MATCH',PROPERTIES ('chunk-size'='1000'))))" />
+    <distsql-case 
id="create-sharding-scaling-rule-with-complete-auto-configuration" 
value="CREATE SHARDING SCALING RULE default_scaling (INPUT 
(WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES 
('qps'='50')))),OUTPUT (WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER 
(TYPE(NAME='TPS',PROPERTIES ('tps'='2000')))),STREAM_CHANNEL (TYPE 
(NAME='MEMORY',PROPERTIES ('block-queue-size'='10000'))),COMPLETION_DETECTOR 
(TYPE (NAME='IDLE',PROPERTIES ('incremental-task-idle-secon [...]
+    <distsql-case id="create-sharding-scaling-rule-with-manual-configuration" 
value="CREATE SHARDING SCALING RULE default_scaling (INPUT 
(WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES 
('qps'='50')))),OUTPUT (WORKER_THREAD=40,BATCH_SIZE=1000,RATE_LIMITER (TYPE 
(NAME='TPS',PROPERTIES ('tps'='2000')))),STREAM_CHANNEL (TYPE 
(NAME='MEMORY',PROPERTIES ('block-queue-size'='10000'))))" />
 </sql-cases>

Reply via email to