This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 6a7907e22f5 Support parsing Doris SHOW FILE and SHOW/DROP
ENCRYPTKEY(S) syntax (#38360)
6a7907e22f5 is described below
commit 6a7907e22f555fed9e8c698efc02419dcf2dcb86
Author: cxy <[email protected]>
AuthorDate: Fri Mar 6 23:37:21 2026 +0800
Support parsing Doris SHOW FILE and SHOW/DROP ENCRYPTKEY(S) syntax (#38360)
---
.../core/database/visitor/SQLVisitorRule.java | 4 ++
.../src/main/antlr4/imports/doris/BaseRule.g4 | 1 +
.../src/main/antlr4/imports/doris/DALStatement.g4 | 10 ++++
.../src/main/antlr4/imports/doris/DDLStatement.g4 | 2 +-
.../src/main/antlr4/imports/doris/DorisKeyword.g4 | 4 ++
.../statement/type/DorisDALStatementVisitor.java | 26 +++++++++
.../statement/type/DorisDDLStatementVisitor.java | 8 ++-
.../ddl/encryptkey/EncryptKeyNameSegment.java | 50 +++++++++++++++++
.../statement/ddl/DropEncryptKeyStatement.java | 11 +++-
.../doris/dal/DorisShowEncryptKeysStatement.java | 61 ++++++++++++++++++++
.../doris/dal/DorisShowFileStatement.java} | 28 ++++++++--
.../dal/dialect/doris/DorisDALStatementAssert.java | 10 ++++
.../type/DorisShowEncryptKeysStatementAssert.java | 65 ++++++++++++++++++++++
.../doris/type/DorisShowFileStatementAssert.java | 45 +++++++++++++++
.../ddl/standard/StandardDDLStatementAssert.java | 5 ++
.../type/DropEncryptKeyStatementAssert.java | 65 ++++++++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 8 +++
.../impl/encryptkey/ExpectedEncryptKeyName.java} | 17 ++++--
.../DorisShowEncryptKeysStatementTestCase.java} | 18 ++++--
.../doris/DorisShowFileStatementTestCase.java} | 14 +++--
.../ddl/DropEncryptKeyStatementTestCase.java | 7 ++-
.../main/resources/case/dal/show-encryptkeys.xml | 44 +++++++++++++++
.../{ddl/drop-encryptkey.xml => dal/show-file.xml} | 13 ++++-
.../main/resources/case/ddl/drop-encryptkey.xml | 25 ++++++++-
.../show-encryptkeys.xml} | 7 ++-
.../{ddl/drop-encryptkey.xml => dal/show-file.xml} | 5 +-
.../sql/supported/ddl/drop-encryptkey.xml | 3 +
27 files changed, 523 insertions(+), 33 deletions(-)
diff --git
a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
index 840f1b1d84c..8d959efd64b 100644
---
a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
+++
b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
@@ -223,6 +223,10 @@ public enum SQLVisitorRule {
DROP_FILE("DropFile", SQLStatementType.DDL),
+ SHOW_FILE("ShowFile", SQLStatementType.DAL),
+
+ SHOW_ENCRYPT_KEYS("ShowEncryptKeys", SQLStatementType.DAL),
+
CREATE_SEQUENCE("CreateSequence", SQLStatementType.DDL),
ALTER_SEQUENCE("AlterSequence", SQLStatementType.DDL),
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
index 2714d0f5b1c..8fe09f65780 100644
--- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
+++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
@@ -220,6 +220,7 @@ identifierKeywordsUnambiguous
| DYNAMIC
| ENABLE
| ENCRYPTION
+ | ENCRYPTKEYS
| ENDS
| ENFORCED
| ENGINES
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
index 924ff2f09f8..4b5a0fb89c6 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
@@ -295,6 +295,14 @@ showData
: SHOW DATA (FROM tableName)? orderByClause?
;
+showFile
+ : SHOW FILE fromDatabase?
+ ;
+
+showEncryptKeys
+ : SHOW ENCRYPTKEYS fromDatabase? showLike?
+ ;
+
setCharacter
: SET (CHARACTER SET | CHARSET) (charsetName | DEFAULT)
;
@@ -874,4 +882,6 @@ show
| showSyncJob
| showDataTypes
| showData
+ | showFile
+ | showEncryptKeys
;
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
index fc2764dd78a..f6aad7f5b84 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
@@ -446,7 +446,7 @@ createEncryptKey
;
dropEncryptKey
- : DROP ENCRYPTKEY identifier
+ : DROP ENCRYPTKEY ifExists? encryptKeyName
;
createView
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
index 0fda3fbe52c..436a711aab6 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
@@ -721,6 +721,10 @@ ENCRYPTKEY
: E N C R Y P T K E Y
;
+ENCRYPTKEYS
+ : E N C R Y P T K E Y S
+ ;
+
END
: E N D
;
diff --git
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
index f1fc173335c..143dfa02dd1 100644
---
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
+++
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
@@ -152,6 +152,8 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowPro
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowSyncJobContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowDataTypesContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowDataContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowEncryptKeysContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowFileContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterSqlBlockRuleContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropSqlBlockRuleContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ShowSqlBlockRuleContext;
@@ -232,6 +234,8 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowProcSta
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowSyncJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowDataTypesStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowDataStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowEncryptKeysStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowFileStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowSqlBlockRuleStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowRoutineLoadTaskStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowRoutineLoadStatement;
@@ -1482,6 +1486,28 @@ public final class DorisDALStatementVisitor extends
DorisStatementVisitor implem
return result;
}
+ @Override
+ public ASTNode visitShowFile(final ShowFileContext ctx) {
+ DorisShowFileStatement result = new
DorisShowFileStatement(getDatabaseType());
+ if (null != ctx.fromDatabase()) {
+ result.setFromDatabase(((FromDatabaseSegment)
visit(ctx.fromDatabase())).getDatabase());
+ }
+ return result;
+ }
+
+ @Override
+ public ASTNode visitShowEncryptKeys(final ShowEncryptKeysContext ctx) {
+ DorisShowEncryptKeysStatement result = new
DorisShowEncryptKeysStatement(getDatabaseType());
+ if (null != ctx.fromDatabase()) {
+ result.setFromDatabase((FromDatabaseSegment)
visit(ctx.fromDatabase()));
+ }
+ if (null != ctx.showLike()) {
+ result.setLikeSegment((ShowLikeSegment) visit(ctx.showLike()));
+ }
+ result.addParameterMarkers(getParameterMarkerSegments());
+ return result;
+ }
+
@Override
public ASTNode visitBackup(final BackupContext ctx) {
DorisBackupStatement result = new
DorisBackupStatement(getDatabaseType());
diff --git
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
index 2dbdec82b90..322d50cd05e 100644
---
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
+++
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
@@ -174,6 +174,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constrain
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constraint.alter.DropConstraintDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constraint.alter.ModifyConstraintDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.distribution.ModifyDistributionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.encryptkey.EncryptKeyNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.engine.EngineSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.engine.ModifyEngineSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.feature.EnableFeatureSegment;
@@ -1874,6 +1875,11 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
@Override
public ASTNode visitDropEncryptKey(final DropEncryptKeyContext ctx) {
- return new DropEncryptKeyStatement(getDatabaseType());
+ EncryptKeyNameSegment keyName =
+ new
EncryptKeyNameSegment(ctx.encryptKeyName().start.getStartIndex(),
ctx.encryptKeyName().stop.getStopIndex(), (IdentifierValue)
visit(ctx.encryptKeyName().identifier()));
+ if (null != ctx.encryptKeyName().owner()) {
+ keyName.setOwner((OwnerSegment)
visit(ctx.encryptKeyName().owner()));
+ }
+ return new DropEncryptKeyStatement(getDatabaseType(), null !=
ctx.ifExists(), keyName);
}
}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/encryptkey/EncryptKeyNameSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/encryptkey/EncryptKeyNameSegment.java
new file mode 100644
index 00000000000..8c2a995a175
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/encryptkey/EncryptKeyNameSegment.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.encryptkey;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerAvailable;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+
+import java.util.Optional;
+
+/**
+ * Encrypt key name segment.
+ */
+@RequiredArgsConstructor
+@Getter
+@Setter
+public final class EncryptKeyNameSegment implements SQLSegment, OwnerAvailable
{
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final IdentifierValue identifier;
+
+ private OwnerSegment owner;
+
+ @Override
+ public Optional<OwnerSegment> getOwner() {
+ return Optional.ofNullable(owner);
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
index 6f3ff2ace7d..f2b8a95f81d 100644
---
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
@@ -17,15 +17,24 @@
package org.apache.shardingsphere.sql.parser.statement.core.statement.ddl;
+import lombok.Getter;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.encryptkey.EncryptKeyNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement;
/**
* Drop encrypt key statement.
*/
+@Getter
public final class DropEncryptKeyStatement extends DDLStatement {
- public DropEncryptKeyStatement(final DatabaseType databaseType) {
+ private final boolean ifExists;
+
+ private final EncryptKeyNameSegment keyName;
+
+ public DropEncryptKeyStatement(final DatabaseType databaseType, final
boolean ifExists, final EncryptKeyNameSegment keyName) {
super(databaseType);
+ this.ifExists = ifExists;
+ this.keyName = keyName;
}
}
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowEncryptKeysStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowEncryptKeysStatement.java
new file mode 100644
index 00000000000..cf364d78c1c
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowEncryptKeysStatement.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.statement.doris.dal;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.FromDatabaseSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.ShowLikeSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+
+import java.util.Optional;
+
+/**
+ * Show encrypt keys statement for Doris.
+ */
+@Getter
+@Setter
+public final class DorisShowEncryptKeysStatement extends DALStatement {
+
+ private FromDatabaseSegment fromDatabase;
+
+ private ShowLikeSegment likeSegment;
+
+ public DorisShowEncryptKeysStatement(final DatabaseType databaseType) {
+ super(databaseType);
+ }
+
+ /**
+ * Get from database segment.
+ *
+ * @return from database segment
+ */
+ public Optional<FromDatabaseSegment> getFromDatabase() {
+ return Optional.ofNullable(fromDatabase);
+ }
+
+ /**
+ * Get like segment.
+ *
+ * @return like segment
+ */
+ public Optional<ShowLikeSegment> getLike() {
+ return Optional.ofNullable(likeSegment);
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowFileStatement.java
similarity index 58%
copy from
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
copy to
parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowFileStatement.java
index 6f3ff2ace7d..ec017e637c6 100644
---
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropEncryptKeyStatement.java
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisShowFileStatement.java
@@ -15,17 +15,35 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sql.parser.statement.core.statement.ddl;
+package org.apache.shardingsphere.sql.parser.statement.doris.dal;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DatabaseSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+
+import java.util.Optional;
/**
- * Drop encrypt key statement.
+ * Show file statement for Doris.
*/
-public final class DropEncryptKeyStatement extends DDLStatement {
+@Getter
+@Setter
+public final class DorisShowFileStatement extends DALStatement {
+
+ private DatabaseSegment fromDatabase;
- public DropEncryptKeyStatement(final DatabaseType databaseType) {
+ public DorisShowFileStatement(final DatabaseType databaseType) {
super(databaseType);
}
+
+ /**
+ * Get from database segment.
+ *
+ * @return from database segment
+ */
+ public Optional<DatabaseSegment> getFromDatabase() {
+ return Optional.ofNullable(fromDatabase);
+ }
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
index ddd2fa77b83..d4c4bdd4bc8 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
@@ -37,6 +37,8 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowDataSta
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowDataTypesStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowProcStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowCreateRoutineLoadStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowEncryptKeysStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowFileStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowSyncJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisSwitchStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.show.DorisShowQueryStatsStatement;
@@ -58,6 +60,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.d
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowProcStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowCreateRoutineLoadStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowQueryStatsStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowEncryptKeysStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowFileStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowSyncJobStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisSwitchStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisUnsetVariableStatementAssert;
@@ -78,6 +82,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowDataTypesStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowProcStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowCreateRoutineLoadStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowEncryptKeysStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowFileStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowSyncJobStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisSwitchStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisUnsetVariableStatementTestCase;
@@ -137,6 +143,10 @@ public final class DorisDALStatementAssert {
DorisAdminSetReplicaVersionStatementAssert.assertIs(assertContext,
(DorisAdminSetReplicaVersionStatement) actual,
(DorisAdminSetReplicaVersionStatementTestCase) expected);
} else if (actual instanceof DorisAdminCopyTabletStatement) {
DorisAdminCopyTabletStatementAssert.assertIs(assertContext,
(DorisAdminCopyTabletStatement) actual, (DorisAdminCopyTabletStatementTestCase)
expected);
+ } else if (actual instanceof DorisShowFileStatement) {
+ DorisShowFileStatementAssert.assertIs(assertContext,
(DorisShowFileStatement) actual, (DorisShowFileStatementTestCase) expected);
+ } else if (actual instanceof DorisShowEncryptKeysStatement) {
+ DorisShowEncryptKeysStatementAssert.assertIs(assertContext,
(DorisShowEncryptKeysStatement) actual, (DorisShowEncryptKeysStatementTestCase)
expected);
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowEncryptKeysStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowEncryptKeysStatementAssert.java
new file mode 100644
index 00000000000..28be09e74fc
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowEncryptKeysStatementAssert.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.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowEncryptKeysStatement;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.database.DatabaseAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowEncryptKeysStatementTestCase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Show encrypt keys statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisShowEncryptKeysStatementAssert {
+
+ /**
+ * Assert show encrypt keys statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show encrypt keys statement
+ * @param expected expected show encrypt keys statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisShowEncryptKeysStatement actual, final
DorisShowEncryptKeysStatementTestCase expected) {
+ assertFromDatabase(assertContext, actual, expected);
+ assertLike(assertContext, actual, expected);
+ }
+
+ private static void assertFromDatabase(final SQLCaseAssertContext
assertContext, final DorisShowEncryptKeysStatement actual, final
DorisShowEncryptKeysStatementTestCase expected) {
+ if (null != expected.getFromDatabase()) {
+ assertTrue(actual.getFromDatabase().isPresent(),
assertContext.getText("Actual from database should exist."));
+ DatabaseAssert.assertIs(assertContext,
actual.getFromDatabase().get().getDatabase(),
expected.getFromDatabase().getDatabase());
+ SQLSegmentAssert.assertIs(assertContext,
actual.getFromDatabase().get(), expected.getFromDatabase());
+ }
+ }
+
+ private static void assertLike(final SQLCaseAssertContext assertContext,
final DorisShowEncryptKeysStatement actual, final
DorisShowEncryptKeysStatementTestCase expected) {
+ if (null != expected.getLike()) {
+ assertTrue(actual.getLike().isPresent(),
assertContext.getText("Actual like segment should exist."));
+ assertThat(assertContext.getText("Like pattern assertion error:
"), actual.getLike().get().getPattern(), is(expected.getLike().getPattern()));
+ SQLSegmentAssert.assertIs(assertContext, actual.getLike().get(),
expected.getLike());
+ }
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFileStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFileStatementAssert.java
new file mode 100644
index 00000000000..f46b16cb7fe
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFileStatementAssert.java
@@ -0,0 +1,45 @@
+/*
+ * 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.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowFileStatement;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.database.DatabaseAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowFileStatementTestCase;
+
+/**
+ * Show file statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisShowFileStatementAssert {
+
+ /**
+ * Assert show file statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show file statement
+ * @param expected expected show file statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisShowFileStatement actual, final DorisShowFileStatementTestCase
expected) {
+ if (null != expected.getFromDatabase()) {
+ DatabaseAssert.assertIs(assertContext,
actual.getFromDatabase().orElse(null), expected.getFromDatabase());
+ }
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/StandardDDLStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/StandardDDLStatementAssert.java
index 0c925a8fe6a..f2428287f28 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/StandardDDLStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/StandardDDLStatementAssert.java
@@ -47,6 +47,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.vi
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.DropViewStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.RefreshMatViewStmtStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFileStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropEncryptKeyStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFileStatement;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.oracle.database.OracleAlterPluggableDatabaseStatementTestCase;
@@ -64,6 +65,7 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.d
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.CreateTableStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.CreateViewStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.CreateFileStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.DropEncryptKeyStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.DropFileStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.CursorStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.DropIndexStatementAssert;
@@ -105,6 +107,7 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.view.DropViewStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.view.RefreshMatViewStmtStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.CreateFileStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.DropEncryptKeyStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.DropFileStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.plsql.CreateProcedureTestCase;
@@ -180,6 +183,8 @@ public final class StandardDDLStatementAssert {
DropFileStatementAssert.assertIs(assertContext,
(DropFileStatement) actual, (DropFileStatementTestCase) expected);
} else if (actual instanceof CancelAlterTableStatement) {
CancelAlterTableStatementAssert.assertIs(assertContext,
(CancelAlterTableStatement) actual, (CancelAlterTableStatementTestCase)
expected);
+ } else if (actual instanceof DropEncryptKeyStatement) {
+ DropEncryptKeyStatementAssert.assertIs(assertContext,
(DropEncryptKeyStatement) actual, (DropEncryptKeyStatementTestCase) expected);
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropEncryptKeyStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropEncryptKeyStatementAssert.java
new file mode 100644
index 00000000000..5741b6d9bda
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropEncryptKeyStatementAssert.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.test.it.sql.parser.internal.asserts.statement.ddl.standard.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropEncryptKeyStatement;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.DropEncryptKeyStatementTestCase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Drop encrypt key statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DropEncryptKeyStatementAssert {
+
+ /**
+ * Assert drop encrypt key statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual drop encrypt key statement
+ * @param expected expected drop encrypt key statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DropEncryptKeyStatement actual, final DropEncryptKeyStatementTestCase
expected) {
+ assertIfExists(assertContext, actual, expected);
+ assertKeyName(assertContext, actual, expected);
+ }
+
+ private static void assertIfExists(final SQLCaseAssertContext
assertContext, final DropEncryptKeyStatement actual, final
DropEncryptKeyStatementTestCase expected) {
+ assertThat(assertContext.getText("IF EXISTS assertion error: "),
actual.isIfExists(), is(expected.isIfExists()));
+ }
+
+ private static void assertKeyName(final SQLCaseAssertContext
assertContext, final DropEncryptKeyStatement actual, final
DropEncryptKeyStatementTestCase expected) {
+ if (null != expected.getKeyName()) {
+ assertNotNull(actual.getKeyName(), assertContext.getText("Key name
should not be null"));
+ assertThat(assertContext.getText("Key name assertion error: "),
actual.getKeyName().getIdentifier().getValue(),
is(expected.getKeyName().getName()));
+ SQLSegmentAssert.assertIs(assertContext, actual.getKeyName(),
expected.getKeyName());
+ if (null != expected.getKeyName().getOwner()) {
+ assertNotNull(actual.getKeyName().getOwner().orElse(null),
assertContext.getText("Owner should not be null"));
+ assertThat(assertContext.getText("Owner name assertion error:
"), actual.getKeyName().getOwner().get().getIdentifier().getValue(),
is(expected.getKeyName().getOwner().getName()));
+ SQLSegmentAssert.assertIs(assertContext,
actual.getKeyName().getOwner().get(), expected.getKeyName().getOwner());
+ }
+ }
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index f2f5376d059..bbfdeba4764 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -51,6 +51,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowProcStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowDataTypesStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowDataStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowEncryptKeysStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowFileStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowSyncJobStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowSqlBlockRuleStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowRoutineLoadTaskStatementTestCase;
@@ -584,6 +586,12 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "show-sync-job")
private final List<DorisShowSyncJobStatementTestCase>
dorisShowSyncJobTestCases = new LinkedList<>();
+ @XmlElement(name = "show-file")
+ private final List<DorisShowFileStatementTestCase> dorisShowFileTestCases
= new LinkedList<>();
+
+ @XmlElement(name = "show-encryptkeys")
+ private final List<DorisShowEncryptKeysStatementTestCase>
dorisShowEncryptKeysTestCases = new LinkedList<>();
+
@XmlElement(name = "create-sync-job")
private final List<DorisCreateSyncJobStatementTestCase>
createSyncJobTestCases = new LinkedList<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/encryptkey/ExpectedEncryptKeyName.java
similarity index 69%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/encryptkey/ExpectedEncryptKeyName.java
index c3a692384c8..f06da408b01 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/encryptkey/ExpectedEncryptKeyName.java
@@ -15,21 +15,26 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.encryptkey;
import lombok.Getter;
import lombok.Setter;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.table.ExpectedOwner;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
/**
- * Drop encrypt key statement test case.
+ * Expected encrypt key name.
*/
@Getter
@Setter
-public final class DropEncryptKeyStatementTestCase extends SQLParserTestCase {
+public final class ExpectedEncryptKeyName extends AbstractExpectedSQLSegment {
- @XmlElement(name = "key-name")
- private String keyName;
+ @XmlAttribute
+ private String name;
+
+ @XmlElement
+ private ExpectedOwner owner;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowEncryptKeysStatementTestCase.java
similarity index 60%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowEncryptKeysStatementTestCase.java
index c3a692384c8..b0a213aa222 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowEncryptKeysStatementTestCase.java
@@ -15,21 +15,29 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris;
import lombok.Getter;
import lombok.Setter;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.from.ExpectedFromDatabase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.like.ExpectedLikeClause;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
/**
- * Drop encrypt key statement test case.
+ * Show encrypt keys statement test case for Doris.
*/
+@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class DropEncryptKeyStatementTestCase extends SQLParserTestCase {
+public final class DorisShowEncryptKeysStatementTestCase extends
SQLParserTestCase {
- @XmlElement(name = "key-name")
- private String keyName;
+ @XmlElement(name = "database")
+ private ExpectedFromDatabase fromDatabase;
+
+ @XmlElement(name = "like")
+ private ExpectedLikeClause like;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowFileStatementTestCase.java
similarity index 68%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowFileStatementTestCase.java
index c3a692384c8..a328e45f92d 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisShowFileStatementTestCase.java
@@ -15,21 +15,25 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris;
import lombok.Getter;
import lombok.Setter;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.database.ExpectedDatabase;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
/**
- * Drop encrypt key statement test case.
+ * Show file statement test case for Doris.
*/
+@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class DropEncryptKeyStatementTestCase extends SQLParserTestCase {
+public final class DorisShowFileStatementTestCase extends SQLParserTestCase {
- @XmlElement(name = "key-name")
- private String keyName;
+ @XmlElement(name = "database")
+ private ExpectedDatabase fromDatabase;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
index c3a692384c8..1ef8252733a 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropEncryptKeyStatementTestCase.java
@@ -20,7 +20,9 @@ package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.
import lombok.Getter;
import lombok.Setter;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.encryptkey.ExpectedEncryptKeyName;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
/**
@@ -30,6 +32,9 @@ import javax.xml.bind.annotation.XmlElement;
@Setter
public final class DropEncryptKeyStatementTestCase extends SQLParserTestCase {
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
+
@XmlElement(name = "key-name")
- private String keyName;
+ private ExpectedEncryptKeyName keyName;
}
diff --git a/test/it/parser/src/main/resources/case/dal/show-encryptkeys.xml
b/test/it/parser/src/main/resources/case/dal/show-encryptkeys.xml
new file mode 100644
index 00000000000..61d5d25024d
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/dal/show-encryptkeys.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-parser-test-cases>
+ <show-encryptkeys sql-case-id="show_encryptkeys" />
+
+ <show-encryptkeys sql-case-id="show_encryptkeys_from_database">
+ <database start-index="17" stop-index="31">
+ <database name="example_db" start-index="22" stop-index="31" />
+ </database>
+ </show-encryptkeys>
+
+ <show-encryptkeys sql-case-id="show_encryptkeys_in_database">
+ <database start-index="17" stop-index="29">
+ <database name="example_db" start-index="20" stop-index="29" />
+ </database>
+ </show-encryptkeys>
+
+ <show-encryptkeys sql-case-id="show_encryptkeys_like">
+ <like pattern="%test%" start-index="17" stop-index="29" />
+ </show-encryptkeys>
+
+ <show-encryptkeys sql-case-id="show_encryptkeys_from_database_like">
+ <database start-index="17" stop-index="31">
+ <database name="example_db" start-index="22" stop-index="31" />
+ </database>
+ <like pattern="%my%" start-index="33" stop-index="43" />
+ </show-encryptkeys>
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
b/test/it/parser/src/main/resources/case/dal/show-file.xml
similarity index 65%
copy from test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
copy to test/it/parser/src/main/resources/case/dal/show-file.xml
index c7994ad20e0..c0b4584e0b0 100644
--- a/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
+++ b/test/it/parser/src/main/resources/case/dal/show-file.xml
@@ -17,6 +17,15 @@
-->
<sql-parser-test-cases>
- <drop-encryptkey sql-case-id="drop_encryptkey" />
- <drop-encryptkey sql-case-id="drop_encryptkey_my_key" />
+ <show-file sql-case-id="show_file_from_database">
+ <database name="example_db" start-index="15" stop-index="24" />
+ </show-file>
+
+ <show-file sql-case-id="show_file_in_database">
+ <database name="example_db" start-index="13" stop-index="22" />
+ </show-file>
+
+ <show-file sql-case-id="show_file_from_quoted_database">
+ <database name="example_db" start-index="15" stop-index="26"
start-delimiter="`" end-delimiter="`" />
+ </show-file>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
b/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
index c7994ad20e0..0776aa1273f 100644
--- a/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
+++ b/test/it/parser/src/main/resources/case/ddl/drop-encryptkey.xml
@@ -17,6 +17,27 @@
-->
<sql-parser-test-cases>
- <drop-encryptkey sql-case-id="drop_encryptkey" />
- <drop-encryptkey sql-case-id="drop_encryptkey_my_key" />
+ <drop-encryptkey sql-case-id="drop_encryptkey">
+ <key-name name="key_name" start-index="16" stop-index="23" />
+ </drop-encryptkey>
+
+ <drop-encryptkey sql-case-id="drop_encryptkey_my_key">
+ <key-name name="my_key" start-index="16" stop-index="21" />
+ </drop-encryptkey>
+
+ <drop-encryptkey sql-case-id="drop_encryptkey_if_exists" if-exists="true">
+ <key-name name="my_key" start-index="26" stop-index="31" />
+ </drop-encryptkey>
+
+ <drop-encryptkey sql-case-id="drop_encryptkey_if_exists_with_database"
if-exists="true">
+ <key-name name="my_key" start-index="26" stop-index="38">
+ <owner name="testdb" start-index="26" stop-index="31" />
+ </key-name>
+ </drop-encryptkey>
+
+ <drop-encryptkey sql-case-id="drop_encryptkey_with_database">
+ <key-name name="my_key" start-index="16" stop-index="28">
+ <owner name="testdb" start-index="16" stop-index="21" />
+ </key-name>
+ </drop-encryptkey>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
b/test/it/parser/src/main/resources/sql/supported/dal/show-encryptkeys.xml
similarity index 62%
copy from
test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
copy to test/it/parser/src/main/resources/sql/supported/dal/show-encryptkeys.xml
index 5560b4831a4..be367744891 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/show-encryptkeys.xml
@@ -17,6 +17,9 @@
-->
<sql-cases>
- <sql-case id="drop_encryptkey" value="DROP ENCRYPTKEY key_name"
db-types="Doris" />
- <sql-case id="drop_encryptkey_my_key" value="DROP ENCRYPTKEY my_key"
db-types="Doris" />
+ <sql-case id="show_encryptkeys" value="SHOW ENCRYPTKEYS" db-types="Doris"
/>
+ <sql-case id="show_encryptkeys_from_database" value="SHOW ENCRYPTKEYS FROM
example_db" db-types="Doris" />
+ <sql-case id="show_encryptkeys_in_database" value="SHOW ENCRYPTKEYS IN
example_db" db-types="Doris" />
+ <sql-case id="show_encryptkeys_like" value='SHOW ENCRYPTKEYS LIKE
"%test%"' db-types="Doris" />
+ <sql-case id="show_encryptkeys_from_database_like" value='SHOW ENCRYPTKEYS
FROM example_db LIKE "%my%"' db-types="Doris" />
</sql-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
b/test/it/parser/src/main/resources/sql/supported/dal/show-file.xml
similarity index 74%
copy from
test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
copy to test/it/parser/src/main/resources/sql/supported/dal/show-file.xml
index 5560b4831a4..6e3d78f2cdf 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/show-file.xml
@@ -17,6 +17,7 @@
-->
<sql-cases>
- <sql-case id="drop_encryptkey" value="DROP ENCRYPTKEY key_name"
db-types="Doris" />
- <sql-case id="drop_encryptkey_my_key" value="DROP ENCRYPTKEY my_key"
db-types="Doris" />
+ <sql-case id="show_file_from_database" value="SHOW FILE FROM example_db"
db-types="Doris" />
+ <sql-case id="show_file_in_database" value="SHOW FILE IN example_db"
db-types="Doris" />
+ <sql-case id="show_file_from_quoted_database" value="SHOW FILE FROM
`example_db`" db-types="Doris" />
</sql-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
index 5560b4831a4..a07fb1c4eae 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/drop-encryptkey.xml
@@ -19,4 +19,7 @@
<sql-cases>
<sql-case id="drop_encryptkey" value="DROP ENCRYPTKEY key_name"
db-types="Doris" />
<sql-case id="drop_encryptkey_my_key" value="DROP ENCRYPTKEY my_key"
db-types="Doris" />
+ <sql-case id="drop_encryptkey_if_exists" value="DROP ENCRYPTKEY IF EXISTS
my_key" db-types="Doris" />
+ <sql-case id="drop_encryptkey_if_exists_with_database" value="DROP
ENCRYPTKEY IF EXISTS testdb.my_key" db-types="Doris" />
+ <sql-case id="drop_encryptkey_with_database" value="DROP ENCRYPTKEY
testdb.my_key" db-types="Doris" />
</sql-cases>