You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/10/25 07:35:36 UTC
[shardingsphere] branch master updated: Add DistSQL syntax: `show
all variables` (#13249)
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 6fe84b1 Add DistSQL syntax: `show all variables` (#13249)
6fe84b1 is described below
commit 6fe84b185ac9e10e9cd00b941294f784dc585ef0
Author: Raigor <ra...@gmail.com>
AuthorDate: Mon Oct 25 15:34:55 2021 +0800
Add DistSQL syntax: `show all variables` (#13249)
* Add DistSQL syntax: show all variables.
* Merge master branch.
---
.../src/main/antlr4/imports/Keyword.g4 | 8 +++
.../src/main/antlr4/imports/RALStatement.g4 | 4 ++
.../parser/autogen/CommonDistSQLStatement.g4 | 1 +
.../core/common/CommonDistSQLStatementVisitor.java | 7 +++
.../ral/common/hint/ClearHintStatement.java | 4 --
...atement.java => ShowAllVariablesStatement.java} | 8 +--
.../ral/common/show/ShowInstanceStatement.java | 4 --
.../hint/ClearReadwriteSplittingHintStatement.java | 4 --
.../ShowReadwriteSplittingHintStatusStatement.java | 4 --
.../statement/hint/ClearShardingHintStatement.java | 4 --
.../hint/ShowShardingHintStatusStatement.java | 4 --
.../distsql/ral/common/enums/VariableEnum.java | 26 +++++++++
.../common/show/ShowStatementExecutorFactory.java | 11 +++-
.../show/executor/ShowAllVariablesExecutor.java | 65 ++++++++++++++++++++++
.../common/show/executor/ShowVariableExecutor.java | 21 +------
.../TextProtocolBackendHandlerFactoryTest.java | 7 ++-
.../ral/ShowAllVariablesBackendHandlerTest.java | 65 ++++++++++++++++++++++
.../ral/impl/CommonDistSQLStatementAssert.java | 5 ++
.../common/ShowAllVariablesStatementAssert.java | 38 +++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 ++
.../ral/ShowAllVariablesStatementTestCase.java | 23 +++-----
.../src/main/resources/case/ral/show.xml | 1 +
.../src/main/resources/sql/supported/ral/show.xml | 1 +
23 files changed, 249 insertions(+), 71 deletions(-)
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4 b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
index c9196cf..f272afd 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
@@ -27,6 +27,10 @@ ADD
: A D D
;
+ALL
+ : A L L
+ ;
+
ALTER
: A L T E R
;
@@ -95,6 +99,10 @@ VARIABLE
: V A R I A B L E
;
+VARIABLES
+ : V A R I A B L E S
+ ;
+
HINT
: H I N T
;
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RALStatement.g4 b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RALStatement.g4
index 5a8e043..e2107ae 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RALStatement.g4
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RALStatement.g4
@@ -27,6 +27,10 @@ showVariable
: SHOW VARIABLE variableName
;
+showAllVariables
+ : SHOW ALL VARIABLES
+ ;
+
enableInstance
:ENABLE INSTANCE IP EQ ip COMMA PORT EQ port
;
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4 b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
index 3790316..056be42 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
@@ -26,6 +26,7 @@ execute
| showResources
| setVariable
| showVariable
+ | showAllVariables
| clearHint
| enableInstance
| disableInstance
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
index a8241c7..53aae9d 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
@@ -31,6 +31,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementPa
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.PoolPropertyContext;
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.SchemaNameContext;
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.SetVariableContext;
+import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowAllVariablesContext;
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowInstanceContext;
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowResourcesContext;
import org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowSinglesTableRulesContext;
@@ -39,6 +40,7 @@ import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.hint.ClearHintStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.set.SetInstanceStatusStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.set.SetVariableStatement;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowAllVariablesStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowInstanceStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowVariableStatement;
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterResourceStatement;
@@ -148,6 +150,11 @@ public final class CommonDistSQLStatementVisitor extends CommonDistSQLStatementB
return new ShowVariableStatement(getIdentifierValue(ctx.variableName()));
}
+ @Override
+ public ASTNode visitShowAllVariables(final ShowAllVariablesContext ctx) {
+ return new ShowAllVariablesStatement();
+ }
+
private String getIdentifierValue(final ParseTree context) {
if (null == context) {
return null;
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/hint/ClearHintStatement.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/hint/ClearHintStatement.java
index 99ae6b8..f203e99 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/hint/ClearHintStatement.java
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/hint/ClearHintStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.distsql.parser.statement.ral.common.hint;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.HintDistSQLStatement;
/**
* Clear hint statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ClearHintStatement extends HintDistSQLStatement {
}
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowAllVariablesStatement.java
similarity index 83%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java
copy to shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowAllVariablesStatement.java
index 131557d..91e8017 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowAllVariablesStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.distsql.parser.statement.ral.common.show;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.ShowDistSQLStatement;
/**
- * Show instance statement.
+ * Show all variables statement.
*/
-@RequiredArgsConstructor
-@Getter
-public final class ShowInstanceStatement extends ShowDistSQLStatement {
+public final class ShowAllVariablesStatement extends ShowDistSQLStatement {
}
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java
index 131557d..0fa3491 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/show/ShowInstanceStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.distsql.parser.statement.ral.common.show;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.ShowDistSQLStatement;
/**
* Show instance statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ShowInstanceStatement extends ShowDistSQLStatement {
}
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ClearReadwriteSplittingHintStatement.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphe [...]
index 9a8a893..bb12baf 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ClearReadwriteSplittingHintStatement.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ClearReadwriteSplittingHintStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.HintDistSQLStatement;
/**
* Clear readwrite-splitting hint statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ClearReadwriteSplittingHintStatement extends HintDistSQLStatement {
}
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ShowReadwriteSplittingHintStatusStatement.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardin [...]
index d535454..b310242 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ShowReadwriteSplittingHintStatusStatement.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/hint/ShowReadwriteSplittingHintStatusStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.HintDistSQLStatement;
/**
* Show readwrite-splitting hint status statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ShowReadwriteSplittingHintStatusStatement extends HintDistSQLStatement {
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ClearShardingHintStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ClearShardingHintStatement.java
index d471109..018ed1f 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ClearShardingHintStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ClearShardingHintStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.sharding.distsql.parser.statement.hint;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.HintDistSQLStatement;
/**
* Clear sharding hint statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ClearShardingHintStatement extends HintDistSQLStatement {
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ShowShardingHintStatusStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ShowShardingHintStatusStatement.java
index 2fa87f8..ca7fc84 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ShowShardingHintStatusStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/hint/ShowShardingHintStatusStatement.java
@@ -17,14 +17,10 @@
package org.apache.shardingsphere.sharding.distsql.parser.statement.hint;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.HintDistSQLStatement;
/**
* Show sharding hint status statement.
*/
-@RequiredArgsConstructor
-@Getter
public final class ShowShardingHintStatusStatement extends HintDistSQLStatement {
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/enums/VariableEnum.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/enums/VariableEnum.java
index f31f408..0ee5e7f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/enums/VariableEnum.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/enums/VariableEnum.java
@@ -19,6 +19,9 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.UnsupportedVariableException;
+import java.util.Arrays;
+import java.util.Collection;
+
/**
* Variable enum.
*/
@@ -78,4 +81,27 @@ public enum VariableEnum {
throw new UnsupportedVariableException(variableName);
}
}
+
+ /**
+ * Get variables classified as props.
+ * @return collection of variable enum
+ */
+ public static Collection<VariableEnum> getPropsVariables() {
+ return Arrays.asList(
+ VariableEnum.MAX_CONNECTIONS_SIZE_PER_QUERY,
+ VariableEnum.KERNEL_EXECUTOR_SIZE,
+ VariableEnum.PROXY_FRONTEND_FLUSH_THRESHOLD,
+ VariableEnum.PROXY_OPENTRACING_ENABLED,
+ VariableEnum.PROXY_HINT_ENABLED,
+ VariableEnum.SQL_SHOW,
+ VariableEnum.CHECK_TABLE_METADATA_ENABLED,
+ VariableEnum.LOCK_WAIT_TIMEOUT_MILLISECONDS,
+ VariableEnum.SHOW_PROCESS_LIST_ENABLED,
+ VariableEnum.PROXY_BACKEND_QUERY_FETCH_SIZE,
+ VariableEnum.CHECK_DUPLICATE_TABLE_ENABLED,
+ VariableEnum.SQL_COMMENT_PARSE_ENABLED,
+ VariableEnum.PROXY_FRONTEND_EXECUTOR_SIZE,
+ VariableEnum.PROXY_BACKEND_EXECUTOR_SUITABLE,
+ VariableEnum.PROXY_FRONTEND_CONNECTION_LIMIT);
+ }
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ShowStatementExecutorFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ShowStatementExecutorFactory.java
index d247571..476ad16 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ShowStatementExecutorFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ShowStatementExecutorFactory.java
@@ -19,9 +19,11 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show;
import com.mchange.v1.db.sql.UnsupportedTypeException;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.ShowDistSQLStatement;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowAllVariablesStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowInstanceStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowVariableStatement;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.executor.ShowAllVariablesExecutor;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.executor.ShowInstanceExecutor;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.executor.ShowReadwriteSplittingReadResourcesExecutor;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.executor.ShowVariableExecutor;
@@ -46,12 +48,15 @@ public final class ShowStatementExecutorFactory {
if (sqlStatement instanceof ShowInstanceStatement) {
return new ShowInstanceExecutor();
}
- if (sqlStatement instanceof ShowVariableStatement) {
- return new ShowVariableExecutor((ShowVariableStatement) sqlStatement, backendConnection);
- }
if (sqlStatement instanceof ShowReadwriteSplittingReadResourcesStatement) {
return new ShowReadwriteSplittingReadResourcesExecutor((ShowReadwriteSplittingReadResourcesStatement) sqlStatement, backendConnection);
}
+ if (sqlStatement instanceof ShowAllVariablesStatement) {
+ return new ShowAllVariablesExecutor(backendConnection);
+ }
+ if (sqlStatement instanceof ShowVariableStatement) {
+ return new ShowVariableExecutor((ShowVariableStatement) sqlStatement, backendConnection);
+ }
throw new UnsupportedTypeException(sqlStatement.getClass().getCanonicalName());
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowAllVariablesExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowAllVariablesExecutor.java
new file mode 100644
index 0000000..42fd065
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowAllVariablesExecutor.java
@@ -0,0 +1,65 @@
+/*
+ * 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.proxy.backend.text.distsql.ral.common.show.executor;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
+import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Show all variables executor.
+ */
+@RequiredArgsConstructor
+public final class ShowAllVariablesExecutor extends AbstractShowExecutor {
+
+ private final BackendConnection backendConnection;
+
+ @Override
+ protected List<QueryHeader> createQueryHeaders() {
+ List<QueryHeader> result = new LinkedList<>();
+ result.add(new QueryHeader("", "", "variable_name", "variable_name", Types.VARCHAR, "VARCHAR", 100, 0, false, false, false, false));
+ result.add(new QueryHeader("", "", "variable_value", "variable_value", Types.VARCHAR, "VARCHAR", 100, 0, false, false, false, false));
+ return result;
+ }
+
+ @Override
+ protected MergedResult createMergedResult() {
+ List<List<Object>> rows = new LinkedList<>();
+ ConfigurationProperties configurationProperties = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps();
+ VariableEnum.getPropsVariables().stream().forEach(each -> {
+ String propertyValue = configurationProperties.getValue(ConfigurationPropertyKey.valueOf(each.name())).toString();
+ rows.add(Arrays.asList(each.name().toLowerCase(), propertyValue));
+ });
+ rows.add(Arrays.asList(VariableEnum.AGENT_PLUGINS_ENABLED.name().toLowerCase(), SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString())));
+ rows.add(Arrays.asList(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), backendConnection.getConnectionSize()));
+ rows.add(Arrays.asList(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), backendConnection.getTransactionStatus().getTransactionType().name()));
+ return new MultipleLocalDataMergedResult(rows);
+ }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowVariableExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowVariableExecutor.java
index ff4ec9c..5c93885 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowVariableExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowVariableExecutor.java
@@ -32,8 +32,6 @@ import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
import java.sql.Types;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -48,23 +46,6 @@ public final class ShowVariableExecutor extends AbstractShowExecutor {
private final BackendConnection backendConnection;
- private final Collection<VariableEnum> propsVariables = Arrays.asList(
- VariableEnum.MAX_CONNECTIONS_SIZE_PER_QUERY,
- VariableEnum.KERNEL_EXECUTOR_SIZE,
- VariableEnum.PROXY_FRONTEND_FLUSH_THRESHOLD,
- VariableEnum.PROXY_OPENTRACING_ENABLED,
- VariableEnum.PROXY_HINT_ENABLED,
- VariableEnum.SQL_SHOW,
- VariableEnum.CHECK_TABLE_METADATA_ENABLED,
- VariableEnum.LOCK_WAIT_TIMEOUT_MILLISECONDS,
- VariableEnum.SHOW_PROCESS_LIST_ENABLED,
- VariableEnum.PROXY_BACKEND_QUERY_FETCH_SIZE,
- VariableEnum.CHECK_DUPLICATE_TABLE_ENABLED,
- VariableEnum.SQL_COMMENT_PARSE_ENABLED,
- VariableEnum.PROXY_FRONTEND_EXECUTOR_SIZE,
- VariableEnum.PROXY_BACKEND_EXECUTOR_SUITABLE,
- VariableEnum.PROXY_FRONTEND_CONNECTION_LIMIT);
-
@Override
protected List<QueryHeader> createQueryHeaders() {
VariableEnum variable = VariableEnum.getValueOf(sqlStatement.getName());
@@ -74,7 +55,7 @@ public final class ShowVariableExecutor extends AbstractShowExecutor {
@Override
protected MergedResult createMergedResult() {
VariableEnum variable = VariableEnum.getValueOf(sqlStatement.getName());
- if (propsVariables.contains(variable)) {
+ if (VariableEnum.getPropsVariables().contains(variable)) {
ConfigurationProperties configurationProperties = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps();
String propertyValue = configurationProperties.getValue(ConfigurationPropertyKey.valueOf(variable.name())).toString();
return new MultipleLocalDataMergedResult(Collections.singletonList(Collections.singletonList(propertyValue)));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactoryTest.java
index 59c6ba6..1cc027a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactoryTest.java
@@ -18,12 +18,12 @@
package org.apache.shardingsphere.proxy.backend.text;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.mode.manager.ContextManager;
+import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.text.admin.DatabaseAdminQueryBackendHandler;
@@ -109,6 +109,9 @@ public final class TextProtocolBackendHandlerFactoryTest {
sql = "show variable transaction_type";
actual = TextProtocolBackendHandlerFactory.newInstance(databaseType, sql, backendConnection);
assertThat(actual, instanceOf(ShowDistSQLBackendHandler.class));
+ sql = "show all variables";
+ actual = TextProtocolBackendHandlerFactory.newInstance(databaseType, sql, backendConnection);
+ assertThat(actual, instanceOf(ShowDistSQLBackendHandler.class));
sql = "set sharding hint database_value=1";
actual = TextProtocolBackendHandlerFactory.newInstance(databaseType, sql, backendConnection);
assertThat(actual, instanceOf(HintDistSQLBackendHandler.class));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/ShowAllVariablesBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/ShowAllVariablesBackendHandlerTest.java
new file mode 100644
index 0000000..6be8146
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/ShowAllVariablesBackendHandlerTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.proxy.backend.text.distsql.ral;
+
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowAllVariablesStatement;
+import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
+import org.apache.shardingsphere.mode.manager.ContextManager;
+import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+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.text.distsql.ral.common.ShowDistSQLBackendHandler;
+import org.apache.shardingsphere.transaction.core.TransactionType;
+import org.junit.Test;
+
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public final class ShowAllVariablesBackendHandlerTest {
+
+ private final BackendConnection backendConnection = new BackendConnection(TransactionType.LOCAL);
+
+ @Test
+ public void assertShowPropsVariable() throws SQLException {
+ backendConnection.setCurrentSchema("schema");
+ ContextManager contextManager = mock(ContextManager.class);
+ ProxyContext.getInstance().init(contextManager);
+ MetaDataContexts metaDataContexts = mock(MetaDataContexts.class);
+ when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
+ when(metaDataContexts.getProps()).thenReturn(new ConfigurationProperties(new Properties()));
+ ShowDistSQLBackendHandler backendHandler = new ShowDistSQLBackendHandler(new ShowAllVariablesStatement(), backendConnection);
+ ResponseHeader actual = backendHandler.execute();
+ assertThat(actual, instanceOf(QueryResponseHeader.class));
+ assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
+ backendHandler.next();
+ Collection<Object> rowData = backendHandler.getRowData();
+ Iterator<Object> rowDataIterator = rowData.iterator();
+ assertThat(rowDataIterator.next(), is("max_connections_size_per_query"));
+ assertThat(rowDataIterator.next(), is("1"));
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/CommonDistSQLStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/CommonDistSQLStatementAssert.java
index 23cc401..2d39d73 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/CommonDistSQLStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/CommonDistSQLStatementAssert.java
@@ -22,16 +22,19 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.distsql.parser.statement.ral.CommonDistSQLStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.SetDistSQLStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.set.SetVariableStatement;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowAllVariablesStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowInstanceStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowVariableStatement;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.ShowReadwriteSplittingReadResourcesStatement;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.common.SetVariableStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.common.ShowAllVariablesStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.common.ShowVariableStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.query.ShowInstanceStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.query.ShowReadwriteSplittingReadResourcesStatementAssert;
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.SetVariableStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAllVariablesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingReadResourcesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowVariableStatementTestCase;
@@ -54,6 +57,8 @@ public final class CommonDistSQLStatementAssert {
SetVariableStatementAssert.assertIs(assertContext, (SetVariableStatement) actual, (SetVariableStatementTestCase) expected);
} else if (actual instanceof ShowVariableStatement) {
ShowVariableStatementAssert.assertIs(assertContext, (ShowVariableStatement) actual, (ShowVariableStatementTestCase) expected);
+ } else if (actual instanceof ShowAllVariablesStatement) {
+ ShowAllVariablesStatementAssert.assertIs(assertContext, (ShowAllVariablesStatement) actual, (ShowAllVariablesStatementTestCase) expected);
} else if (actual instanceof ShowInstanceStatement) {
ShowInstanceStatementAssert.assertIs(assertContext, (ShowInstanceStatement) actual, (ShowInstanceStatementTestCase) expected);
} else if (actual instanceof ShowReadwriteSplittingReadResourcesStatement) {
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/common/ShowAllVariablesStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/common/ShowAllVariablesStatementAssert.java
new file mode 100644
index 0000000..c495518
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/common/ShowAllVariablesStatementAssert.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.common;
+
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.show.ShowAllVariablesStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAllVariablesStatementTestCase;
+
+/**
+ * Show all variables statement assert.
+ */
+public final class ShowAllVariablesStatementAssert {
+
+ /**
+ * Assert show all variables statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show all variables statement
+ * @param expected expected show all variables statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext, final ShowAllVariablesStatement actual, final ShowAllVariablesStatementTestCase expected) {
+ }
+}
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 2c9abe4..6a4b289 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
@@ -114,6 +114,7 @@ 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.SetReadwriteSplittingHintStatementTestCase;
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.ShowAllVariablesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceStatementTestCase;
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.ShowReadwriteSplittingReadResourcesStatementTestCase;
@@ -554,6 +555,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "show-variable")
private final List<ShowVariableStatementTestCase> showVariableStatementTestCase = new LinkedList<>();
+ @XmlElement(name = "show-all-variables")
+ private final List<ShowAllVariablesStatementTestCase> showAllVariablesStatementTestCase = new LinkedList<>();
+
@XmlElement(name = "set-variable")
private final List<SetVariableStatementTestCase> setVariableStatementTestCase = new LinkedList<>();
@@ -793,6 +797,7 @@ public final class SQLParserTestCases {
putAll(stopScalingSourceWritingStatementTestCase, result);
putAll(checkoutScalingStatementTestCases, result);
putAll(showVariableStatementTestCase, result);
+ putAll(showAllVariablesStatementTestCase, result);
putAll(setVariableStatementTestCase, result);
putAll(previewStatementTestCase, result);
putAll(setReadwriteSplittingHintStatementTestCase, result);
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4 b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowAllVariablesStatementTestCase.java
similarity index 69%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
copy to shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowAllVariablesStatementTestCase.java
index 3790316..8f01f29 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowAllVariablesStatementTestCase.java
@@ -15,21 +15,12 @@
* limitations under the License.
*/
-grammar CommonDistSQLStatement;
+package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral;
-import Symbol, RALStatement, RDLStatement, RQLStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-execute
- : (addResource
- | alterResource
- | dropResource
- | showResources
- | setVariable
- | showVariable
- | clearHint
- | enableInstance
- | disableInstance
- | showInstance
- | showSinglesTableRules
- ) SEMI?
- ;
+/**
+ * Show all variables statement test case.
+ */
+public final class ShowAllVariablesStatementTestCase extends SQLParserTestCase {
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/show.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/show.xml
index 3f5c997..9eb881a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/show.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/show.xml
@@ -18,6 +18,7 @@
<sql-parser-test-cases>
<show-variable sql-case-id="show-variable" />
+ <show-all-variables sql-case-id="show-all-variables" />
<show-readwrite-splitting-hint-source sql-case-id="show-readwrite-splitting-hint-source" />
<show-sharding-hint-status sql-case-id="show-sharding-hint-status" />
<show-instance sql-case-id="show-instance" />
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/show.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/show.xml
index f5d6f21..622314b 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/show.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/show.xml
@@ -18,6 +18,7 @@
<sql-cases>
<distsql-case id="show-variable" value="SHOW VARIABLE CACHED_CONNECTIONS" />
+ <distsql-case id="show-all-variables" value="SHOW ALL VARIABLES" />
<distsql-case id="show-readwrite-splitting-hint-source" value="SHOW READWRITE_SPLITTING HINT STATUS" />
<distsql-case id="show-sharding-hint-status" value="SHOW SHARDING HINT STATUS" />
<distsql-case id="show-instance" value="SHOW INSTANCE LIST" />