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 556135b0dff Refactor parameter type definitions of DistSQL. (#19942)
556135b0dff is described below
commit 556135b0dff5056c0108d96bed811b684dfcf8ab
Author: Raigor <[email protected]>
AuthorDate: Sun Aug 7 22:18:16 2022 +0800
Refactor parameter type definitions of DistSQL. (#19942)
---
.../src/main/antlr4/imports/BaseRule.g4 | 20 ++++--------
.../src/main/antlr4/imports/Literals.g4 | 27 +++------------
.../src/main/antlr4/imports/RALStatement.g4 | 14 ++------
.../src/main/antlr4/imports/RDLStatement.g4 | 34 +++++++++----------
.../src/main/antlr4/imports/RQLStatement.g4 | 6 +---
.../core/kernel/KernelDistSQLStatementVisitor.java | 38 ++++++++++------------
.../handler/ProxyBackendHandlerFactoryTest.java | 2 +-
.../src/test/resources/env/common/command.xml | 20 ++++++------
.../cases/ral/ral-integration-test-cases.xml | 4 +--
.../src/test/resources/env/common/command.xml | 12 +++----
.../main/resources/sql/supported/ral/updatable.xml | 6 ++--
.../src/main/resources/sql/supported/rdl/alter.xml | 18 +++++-----
.../main/resources/sql/supported/rdl/create.xml | 20 ++++++------
13 files changed, 91 insertions(+), 130 deletions(-)
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/BaseRule.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/BaseRule.g4
index a79f20e79e0..ee2cbe9dea3 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/BaseRule.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/BaseRule.g4
@@ -20,7 +20,7 @@ grammar BaseRule;
import Symbol, Keyword, Literals;
propertiesDefinition
- : COMMA PROPERTIES LP properties? RP
+ : PROPERTIES LP properties? RP
;
properties
@@ -28,11 +28,7 @@ properties
;
property
- : key=(IDENTIFIER | STRING) EQ value=(INT | IDENTIFIER | STRING)
- ;
-
-tableName
- : IDENTIFIER
+ : key=STRING EQ value=STRING
;
databaseName
@@ -43,14 +39,10 @@ schemaName
: IDENTIFIER
;
-resourceName
- : IDENTIFIER | STRING
- ;
-
-ip
- : IDENTIFIER | NUMBER+
+tableName
+ : IDENTIFIER
;
-port
- : INT
+resourceName
+ : IDENTIFIER
;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Literals.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Literals.g4
index 4fa37a84115..d8f6d07f77c 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Literals.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Literals.g4
@@ -19,33 +19,16 @@ lexer grammar Literals;
import Alphabet, Symbol;
-STRING
- : (DQ ('\\'. | '""' | ~('"' | '\\'))* DQ)
- | (SQ ('\\'. | '\'\'' | ~('\'' | '\\'))* SQ)
- ;
-
IDENTIFIER
: [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*
| BQ ~'`'+ BQ
- | (DQ ( '\\'. | '""' | ~('"'| '\\') )* DQ)
- ;
-
-INT
- : [0-9]+
;
-HEX
- : [0-9a-fA-F]
- ;
-
-NUMBER
- : INT? DOT? INT (E (PLUS | MINUS)? INT)?
+STRING
+ : (DQ ('\\'. | '""' | ~('"' | '\\'))* DQ)
+ | (SQ ('\\'. | '\'\'' | ~('\'' | '\\'))* SQ)
;
-HEXDIGIT
- : '0x' HEX+ | 'X' SQ HEX+ SQ
- ;
-
-BITNUM
- : '0b' ('0' | '1')+ | B SQ ('0' | '1')+ SQ
+INT
+ : [0-9]+
;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
index 2068c2201a8..d3aacff8f80 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
@@ -128,7 +128,7 @@ loadBalancerDefinition
;
algorithmDefinition
- : TYPE LP NAME EQ typeName (COMMA PROPERTIES LP algorithmProperties? RP)?
RP
+ : TYPE LP NAME EQ typeName (COMMA propertiesDefinition)? RP
;
typeName
@@ -160,7 +160,7 @@ transactionRuleDefinition
;
providerDefinition
- : TYPE LP NAME EQ providerName propertiesDefinition? RP
+ : TYPE LP NAME EQ providerName (COMMA propertiesDefinition)? RP
;
defaultType
@@ -184,7 +184,7 @@ variableValues
;
variableValue
- : IDENTIFIER | STRING | (MINUS)? INT | TRUE | FALSE
+ : STRING | (MINUS)? INT | TRUE | FALSE
;
instanceId
@@ -235,14 +235,6 @@ label
: IDENTIFIER
;
-algorithmProperties
- : algorithmProperty (COMMA algorithmProperty)*
- ;
-
-algorithmProperty
- : key=(IDENTIFIER | STRING) EQ value=(NUMBER | INT | IDENTIFIER | STRING)
- ;
-
ifExists
: IF EXISTS
;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
index a2d15167cfd..3db883e896f 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
@@ -20,34 +20,34 @@ grammar RDLStatement;
import BaseRule;
addResource
- : ADD RESOURCE dataSource (COMMA dataSource)*
+ : ADD RESOURCE resourceDefinition (COMMA resourceDefinition)*
;
alterResource
- : ALTER RESOURCE dataSource (COMMA dataSource)*
+ : ALTER RESOURCE resourceDefinition (COMMA resourceDefinition)*
;
dropResource
- : DROP RESOURCE ifExists? IDENTIFIER (COMMA IDENTIFIER)*
ignoreSingleTables?
+ : DROP RESOURCE ifExists? resourceName (COMMA resourceName)*
ignoreSingleTables?
;
createDefaultSingleTableRule
- : CREATE DEFAULT SINGLE TABLE RULE RESOURCE EQ dataSourceName
+ : CREATE DEFAULT SINGLE TABLE RULE RESOURCE EQ resourceName
;
alterDefaultSingleTableRule
- : ALTER DEFAULT SINGLE TABLE RULE RESOURCE EQ dataSourceName
+ : ALTER DEFAULT SINGLE TABLE RULE RESOURCE EQ resourceName
;
dropDefaultSingleTableRule
: DROP DEFAULT SINGLE TABLE RULE ifExists?
;
-dataSource
- : dataSourceName LP (simpleSource | urlSource) COMMA USER EQ user (COMMA
PASSWORD EQ password+)? propertiesDefinition? RP
+resourceDefinition
+ : resourceName LP (simpleSource | urlSource) COMMA USER EQ user (COMMA
PASSWORD EQ password)? (COMMA propertiesDefinition)? RP
;
-dataSourceName
+resourceName
: IDENTIFIER
;
@@ -60,27 +60,27 @@ urlSource
;
hostname
- : IDENTIFIER | ip
+ : STRING
+ ;
+
+port
+ : INT
;
dbName
- : IDENTIFIER
+ : STRING
;
url
- : (IDENTIFIER | STRING)
+ : STRING
;
user
- : IDENTIFIER | NUMBER
+ : STRING
;
password
- : IDENTIFIER | INT | STRING
- | TILDE | NOT | AT | POUND | DL | MOD | CARET
- | AMPERSAND | ASTERISK | LP | RP | UL | MINUS | PLUS
- | EQ| LBE | RBE | LBT | RBT | SLASH | LT | GT | COMMA
- | DOT | SEMI | QUESTION | SQ | COLON | VERTICALBAR | PASSWORD
+ : STRING
;
ignoreSingleTables
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RQLStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RQLStatement.g4
index c5840cbb3de..5ff87d4a1df 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RQLStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RQLStatement.g4
@@ -32,7 +32,7 @@ showSingleTableRules
;
showSingleTable
- : SHOW SINGLE (table | TABLES) (FROM databaseName)?
+ : SHOW SINGLE (TABLES | TABLE tableName) (FROM databaseName)?
;
countDatabaseRules
@@ -46,7 +46,3 @@ showRulesUsedResource
countSingleTableRule
: COUNT SINGLE_TABLE RULE (FROM databaseName)?
;
-
-table
- : TABLE tableName
- ;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index c7fd337f03d..60c89440a43 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -21,8 +21,6 @@ import org.antlr.v4.runtime.tree.ParseTree;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementBaseVisitor;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AddResourceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmPropertiesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmPropertyContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterDefaultSingleTableRuleContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterInstanceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterResourceContext;
@@ -37,7 +35,6 @@ import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CountSingleTableRuleContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CreateDefaultSingleTableRuleContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CreateTrafficRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DataSourceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DatabaseNameContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DisableInstanceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DiscardDistSQLContext;
@@ -58,6 +55,7 @@ import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PropertyContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ProviderDefinitionContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.RefreshTableMetadataContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ResourceDefinitionContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.SetVariableContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAllVariablesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAuthorityRuleContext;
@@ -135,7 +133,6 @@ import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
import java.util.Properties;
import java.util.stream.Collectors;
@@ -146,12 +143,12 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
@Override
public ASTNode visitAddResource(final AddResourceContext ctx) {
- return new AddResourceStatement(ctx.dataSource().stream().map(each ->
(DataSourceSegment) visit(each)).collect(Collectors.toList()));
+ return new
AddResourceStatement(ctx.resourceDefinition().stream().map(each ->
(DataSourceSegment) visit(each)).collect(Collectors.toList()));
}
@Override
public ASTNode visitAlterResource(final AlterResourceContext ctx) {
- return new AlterResourceStatement(ctx.dataSource().stream().map(each
-> (DataSourceSegment) visit(each)).collect(Collectors.toList()));
+ return new
AlterResourceStatement(ctx.resourceDefinition().stream().map(each ->
(DataSourceSegment) visit(each)).collect(Collectors.toList()));
}
@Override
@@ -161,22 +158,23 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
}
@Override
- public ASTNode visitDataSource(final DataSourceContext ctx) {
+ public ASTNode visitResourceDefinition(final ResourceDefinitionContext
ctx) {
+ String user = getIdentifierValue(ctx.user());
String password = null == ctx.password() ? "" :
getPassword(ctx.password());
Properties props = getProperties(ctx.propertiesDefinition());
DataSourceSegment result = null;
if (null != ctx.urlSource()) {
- result = new
URLBasedDataSourceSegment(getIdentifierValue(ctx.dataSourceName()),
getIdentifierValue(ctx.urlSource().url()), ctx.user().getText(), password,
props);
+ result = new
URLBasedDataSourceSegment(getIdentifierValue(ctx.resourceName()),
getIdentifierValue(ctx.urlSource().url()), user, password, props);
}
if (null != ctx.simpleSource()) {
- result = new
HostnameAndPortBasedDataSourceSegment(getIdentifierValue(ctx.dataSourceName()),
ctx.simpleSource().hostname().getText(), ctx.simpleSource().port().getText(),
- ctx.simpleSource().dbName().getText(),
ctx.user().getText(), password, props);
+ result = new
HostnameAndPortBasedDataSourceSegment(getIdentifierValue(ctx.resourceName()),
getIdentifierValue(ctx.simpleSource().hostname()),
ctx.simpleSource().port().getText(),
+ getIdentifierValue(ctx.simpleSource().dbName()), user,
password, props);
}
return result;
}
- private String getPassword(final List<PasswordContext> passwordContexts) {
- return passwordContexts.stream().map(each -> new
IdentifierValue(each.getText()).getValue()).collect(Collectors.joining(""));
+ private String getPassword(final PasswordContext ctx) {
+ return getIdentifierValue(ctx);
}
@Override
@@ -237,12 +235,12 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
@Override
public ASTNode visitCreateDefaultSingleTableRule(final
CreateDefaultSingleTableRuleContext ctx) {
- return new
CreateDefaultSingleTableRuleStatement(getIdentifierValue(ctx.dataSourceName()));
+ return new
CreateDefaultSingleTableRuleStatement(getIdentifierValue(ctx.resourceName()));
}
@Override
public ASTNode visitAlterDefaultSingleTableRule(final
AlterDefaultSingleTableRuleContext ctx) {
- return new
AlterDefaultSingleTableRuleStatement(getIdentifierValue(ctx.dataSourceName()));
+ return new
AlterDefaultSingleTableRuleStatement(getIdentifierValue(ctx.resourceName()));
}
@Override
@@ -265,7 +263,7 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
public ASTNode visitDropResource(final DropResourceContext ctx) {
boolean ignoreSingleTables = null != ctx.ignoreSingleTables();
return new DropResourceStatement(ctx.ifExists() != null,
- ctx.IDENTIFIER().stream().map(ParseTree::getText).map(each ->
new IdentifierValue(each).getValue()).collect(Collectors.toList()),
ignoreSingleTables);
+ ctx.resourceName().stream().map(ParseTree::getText).map(each
-> new IdentifierValue(each).getValue()).collect(Collectors.toList()),
ignoreSingleTables);
}
@Override
@@ -295,7 +293,7 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
@Override
public ASTNode visitShowSingleTable(final ShowSingleTableContext ctx) {
- return new ShowSingleTableStatement(null == ctx.table() ? null :
getIdentifierValue(ctx.table().tableName()), null == ctx.databaseName() ? null
: (DatabaseSegment) visit(ctx.databaseName()));
+ return new ShowSingleTableStatement(null == ctx.TABLE() ? null :
getIdentifierValue(ctx.tableName()), null == ctx.databaseName() ? null :
(DatabaseSegment) visit(ctx.databaseName()));
}
@Override
@@ -425,15 +423,15 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
@Override
public ASTNode visitAlgorithmDefinition(final AlgorithmDefinitionContext
ctx) {
- return new AlgorithmSegment(getIdentifierValue(ctx.typeName()),
buildProperties(ctx.algorithmProperties()));
+ return new AlgorithmSegment(getIdentifierValue(ctx.typeName()),
buildProperties(ctx.propertiesDefinition()));
}
- private Properties buildProperties(final AlgorithmPropertiesContext
algorithmProps) {
+ private Properties buildProperties(final PropertiesDefinitionContext ctx) {
Properties result = new Properties();
- if (null == algorithmProps) {
+ if (null == ctx) {
return result;
}
- for (AlgorithmPropertyContext each :
algorithmProps.algorithmProperty()) {
+ for (PropertyContext each : ctx.properties().property()) {
result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()),
IdentifierValue.getQuotedContent(each.value.getText()));
}
return result;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
index e65367fcd4d..aa67ae3f66c 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
@@ -112,7 +112,7 @@ public final class ProxyBackendHandlerFactoryTest extends
ProxyContextRestorer {
@Test
public void assertNewInstanceWithCommonDistSQL() throws SQLException {
- String sql = "set variable transaction_type=LOCAL";
+ String sql = "set variable transaction_type='LOCAL'";
ProxyBackendHandler actual =
ProxyBackendHandlerFactory.newInstance(databaseType, sql, connectionSession);
assertThat(actual, instanceOf(SetVariableHandler.class));
sql = "show variable transaction_type";
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
index 2d0c98c9ea5..4c53f91e030 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
@@ -80,28 +80,28 @@
<source-add-resource-template>
ADD RESOURCE ds_0 (
URL="${ds0}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
), ds_1 (
URL="${ds1}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
)
</source-add-resource-template>
<target-add-resource-template>
ADD RESOURCE ds_2 (
URL="${ds2}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
),ds_3 (
URL="${ds3}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
),ds_4 (
URL="${ds4}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
)
</target-add-resource-template>
</command>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
index 47a9722b62c..b6983bbf193 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
@@ -56,8 +56,8 @@
<test-case sql="show variable transaction_type">
<assertion expected-data-file="transaction_type.xml">
- <initial-sql sql="set variable transaction_type = XA"/>
- <destroy-sql sql="set variable transaction_type = LOCAL"/>
+ <initial-sql sql="set variable transaction_type = 'XA'"/>
+ <destroy-sql sql="set variable transaction_type = 'LOCAL'"/>
</assertion>
</test-case>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/common/command.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/common/command.xml
index 467e973ad7c..8900393776a 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/common/command.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/common/command.xml
@@ -104,20 +104,20 @@
<source-add-resource-template>
ADD RESOURCE ds_0 (
URL="${ds0}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
), ds_1 (
URL="${ds1}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
)
</source-add-resource-template>
<source-add-new-resource-template>
ADD RESOURCE ds_2 (
URL="${ds2}",
- USER=${user},
- PASSWORD=${password}
+ USER="${user}",
+ PASSWORD="${password}"
)
</source-add-new-resource-template>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/updatable.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/updatable.xml
index 9e2af6be340..2f4bd32155f 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/updatable.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/updatable.xml
@@ -17,7 +17,7 @@
-->
<sql-cases>
- <distsql-case id="set-variable" value="SET VARIABLE
TRANSACTION_TYPE=LOCAL" />
+ <distsql-case id="set-variable" value="SET VARIABLE
TRANSACTION_TYPE='LOCAL'" />
<distsql-case id="refresh-table-metadata" value="REFRESH TABLE METADATA" />
<distsql-case id="refresh-table-metadata-with-table-name" value="REFRESH
TABLE METADATA t_order" />
@@ -33,8 +33,8 @@
<distsql-case id="alter-traffic-rule" value="ALTER TRAFFIC RULE
sql_match_traffic
(LABELS(OLTP),TRAFFIC_ALGORITHM(TYPE(NAME=SQL_MATCH,PROPERTIES('sql' = 'SELECT
* FROM t_order WHERE order_id = ?; UPDATE t_order SET order_id = ?;'))),
LOAD_BALANCER(TYPE(NAME=RANDOM, PROPERTIES('key'='value'))) )" />
<distsql-case id="drop-traffic-rule" value="DROP TRAFFIC RULE rule_name" />
- <distsql-case id="alter-instance-xa-recovery-nodes" value="ALTER INSTANCE
instance_xa_recovery SET XA_RECOVERY_NODES=instance_1" />
- <distsql-case id="alter-instance-xa-recovery-nodes-with-multiple-values"
value="ALTER INSTANCE instance_xa_recovery_multiple SET
XA_RECOVERY_NODES=instance_1,instance_2 " />
+ <distsql-case id="alter-instance-xa-recovery-nodes" value="ALTER INSTANCE
instance_xa_recovery SET XA_RECOVERY_NODES='instance_1'" />
+ <distsql-case id="alter-instance-xa-recovery-nodes-with-multiple-values"
value="ALTER INSTANCE instance_xa_recovery_multiple SET
XA_RECOVERY_NODES='instance_1,instance_2'" />
<distsql-case id="label-instance" value="LABEL INSTANCE instance_label
WITH OLAP_1,OLAP_2" />
<distsql-case id="relabel-instance" value="RELABEL INSTANCE
instance_relabel WITH OLAP_1,OLAP_2" />
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
index a65947e84d9..b40abdd6ec7 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
@@ -17,15 +17,15 @@
-->
<sql-cases>
- <distsql-case id="alter-resource-simple-single-without-password"
value="ALTER RESOURCE ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT);" />
- <distsql-case id="alter-resource-simple-single-with-password" value="ALTER
RESOURCE ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="alter-resource-simple-multiple" value="ALTER RESOURCE
ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456),
ds_1(HOST=127.0.0.1,PORT=3306,DB=test1,USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="alter-resource-url-single-without-password" value="ALTER
RESOURCE ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT);" />
- <distsql-case id="alter-resource-url-single-with-password" value="ALTER
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="alter-resource-url-multiple" value="ALTER RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456),
ds_1(URL='jdbc:mysql://127.0.0.1:3306/test1',USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="alter-resource-single-with-properties" value="ALTER
RESOURCE
ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456,PROPERTIES('maxPoolSize'=30));"
/>
- <distsql-case id="alter-resource-url-single-with-empty-properties"
value="ALTER RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PROPERTIES())" />
- <distsql-case id="alter-resource-url-single-with-properties" value="ALTER
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456,PROPERTIES('maxPoolSize'=30))"
/>
+ <distsql-case id="alter-resource-simple-single-without-password"
value="ALTER RESOURCE ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT');"
/>
+ <distsql-case id="alter-resource-simple-single-with-password" value="ALTER
RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="alter-resource-simple-multiple" value="ALTER RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456'),
ds_1(HOST='127.0.0.1',PORT=3306,DB='test1',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="alter-resource-url-single-without-password" value="ALTER
RESOURCE ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT');" />
+ <distsql-case id="alter-resource-url-single-with-password" value="ALTER
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="alter-resource-url-multiple" value="ALTER RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456'),
ds_1(URL='jdbc:mysql://127.0.0.1:3306/test1',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="alter-resource-single-with-properties" value="ALTER
RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456',PROPERTIES('maxPoolSize'='30'));"
/>
+ <distsql-case id="alter-resource-url-single-with-empty-properties"
value="ALTER RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PROPERTIES())" />
+ <distsql-case id="alter-resource-url-single-with-properties" value="ALTER
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456',PROPERTIES('maxPoolSize'='30'))"
/>
<distsql-case id="alter-sharding-auto-table-rule" value="ALTER SHARDING
TABLE RULE t_order (RESOURCES(ms_group_0,ms_group_1), SHARDING_COLUMN=order_id,
TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake)))"
/>
<distsql-case id="alter-sharding-auto-table-rule-with-inline-expression"
value="ALTER SHARDING TABLE RULE t_order (RESOURCES('ms_group_${0..1}'),
SHARDING_COLUMN=order_id,
TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake)))"
/>
<distsql-case id="alter-sharding-binding-table-rules" value="ALTER
SHARDING BINDING TABLE RULES (t_order,t_order_item), (t_1,t_2)" />
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 711fd0020a7..8239a03a6f3 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
@@ -17,15 +17,15 @@
-->
<sql-cases>
- <distsql-case id="add-resource-simple-single-without-password" value="ADD
RESOURCE ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT);" />
- <distsql-case id="add-resource-simple-single-with-password" value="ADD
RESOURCE ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="add-resource-simple-multiple" value="ADD RESOURCE
ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456),
ds_1(HOST=127.0.0.1,PORT=3306,DB=test1,USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="add-resource-url-single-without-password" value="ADD
RESOURCE ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT);" />
- <distsql-case id="add-resource-url-single-with-password" value="ADD
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="add-resource-url-multiple" value="ADD RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456),
ds_1(URL='jdbc:mysql://127.0.0.1:3306/test1',USER=ROOT,PASSWORD=123456);" />
- <distsql-case id="add-resource-single-with-properties" value="ADD RESOURCE
ds_0(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT,PASSWORD=123456,PROPERTIES('maxPoolSize'=30));"
/>
- <distsql-case id="add-resource-url-single-with-empty-properties"
value="ADD RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PROPERTIES())" />
- <distsql-case id="add-resource-url-single-with-properties" value="ADD
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER=ROOT,PASSWORD=123456,PROPERTIES('maxPoolSize'=30))"
/>
+ <distsql-case id="add-resource-simple-single-without-password" value="ADD
RESOURCE ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT');" />
+ <distsql-case id="add-resource-simple-single-with-password" value="ADD
RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="add-resource-simple-multiple" value="ADD RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456'),
ds_1(HOST='127.0.0.1',PORT=3306,DB='test1',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="add-resource-url-single-without-password" value="ADD
RESOURCE ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT');" />
+ <distsql-case id="add-resource-url-single-with-password" value="ADD
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="add-resource-url-multiple" value="ADD RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456'),
ds_1(URL='jdbc:mysql://127.0.0.1:3306/test1',USER='ROOT',PASSWORD='123456');" />
+ <distsql-case id="add-resource-single-with-properties" value="ADD RESOURCE
ds_0(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT',PASSWORD='123456',PROPERTIES('maxPoolSize'='30'));"
/>
+ <distsql-case id="add-resource-url-single-with-empty-properties"
value="ADD RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PROPERTIES())" />
+ <distsql-case id="add-resource-url-single-with-properties" value="ADD
RESOURCE
ds_0(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456',PROPERTIES('maxPoolSize'='30'))"
/>
<distsql-case id="create-sharding-auto-table-rule" value="CREATE SHARDING
TABLE RULE t_order (RESOURCES(ms_group_0,ms_group_1),
SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),
KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake)))" />
<distsql-case id="create-sharding-auto-table-rule-with-inline-expression"
value="CREATE SHARDING TABLE RULE t_order (RESOURCES('ms_group_${0..1}'),
SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),
KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake)))" />
<distsql-case id="create-sharding-binding-table-rule" value="CREATE
SHARDING BINDING TABLE RULES (t_order,t_order_item), (t_1,t_2)" />
@@ -51,7 +51,7 @@
<distsql-case id="create-shadow-algorithm" value="CREATE SHADOW ALGORITHM
(simple_hint_algorithm, TYPE(NAME=HINT, PROPERTIES('shadow'='true',
'foo'='bar')))" />
<distsql-case id="create-default-single-table" value="CREATE DEFAULT
SINGLE TABLE RULE RESOURCE = ds_0" />
- <distsql-case id="add-resource-with-quota" value="ADD RESOURCE
`ds_0`(HOST=127.0.0.1,PORT=3306,DB=test0,USER=ROOT);" />
+ <distsql-case id="add-resource-with-quota" value="ADD RESOURCE
`ds_0`(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT');" />
<distsql-case id="create-sharding-auto-table-rule-with-quota"
value="CREATE SHARDING TABLE RULE `t_order` (RESOURCES(ms_group_0,ms_group_1),
SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),
KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake)))" />
<distsql-case id="create-sharding-binding-table-rule-with-quota"
value="CREATE SHARDING BINDING TABLE RULES (`t_order`,`t_order_item`),
(t_1,t_2)" />
<distsql-case id="create-sharding-broadcast-table-rule-with-quota"
value="CREATE SHARDING BROADCAST TABLE RULES(`t_1`,`t_2`)" />