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 452ab35cb83 Support parsing Doris CREATE/DROP FILE syntax (#38050)
452ab35cb83 is described below

commit 452ab35cb830e46d1f642a5cbb10a862aa2cdc1d
Author: cxy <[email protected]>
AuthorDate: Mon Feb 16 18:15:46 2026 +0800

    Support parsing Doris CREATE/DROP FILE syntax (#38050)
---
 .../core/database/visitor/SQLVisitorRule.java      |  4 +
 .../src/main/antlr4/imports/doris/DDLStatement.g4  | 12 +++
 .../sql/parser/autogen/DorisStatement.g4           |  2 +
 .../statement/type/DorisDDLStatementVisitor.java   | 41 ++++++++++
 .../core/statement/ddl/CreateFileStatement.java    | 42 +++++++++++
 .../core/statement/ddl/DropFileStatement.java      | 42 +++++++++++
 .../ddl/standard/StandardDDLStatementAssert.java   | 10 +++
 .../standard/type/CreateFileStatementAssert.java   | 87 ++++++++++++++++++++++
 .../ddl/standard/type/DropFileStatementAssert.java | 87 ++++++++++++++++++++++
 .../cases/parser/jaxb/RootSQLParserTestCases.java  |  8 ++
 .../statement/ddl/CreateFileStatementTestCase.java | 43 +++++++++++
 .../statement/ddl/DropFileStatementTestCase.java   | 43 +++++++++++
 .../src/main/resources/case/ddl/create-file.xml    | 55 ++++++++++++++
 .../src/main/resources/case/ddl/drop-file.xml      | 50 +++++++++++++
 .../resources/sql/supported/ddl/create-file.xml    | 25 +++++++
 .../main/resources/sql/supported/ddl/drop-file.xml | 25 +++++++
 16 files changed, 576 insertions(+)

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 bf44cce34f5..a9c7959c6e3 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
@@ -215,6 +215,10 @@ public enum SQLVisitorRule {
     
     ANALYZE("Analyze", SQLStatementType.DDL),
     
+    CREATE_FILE("CreateFile", SQLStatementType.DDL),
+    
+    DROP_FILE("DropFile", SQLStatementType.DDL),
+    
     CREATE_SEQUENCE("CreateSequence", SQLStatementType.DDL),
     
     ALTER_SEQUENCE("AlterSequence", SQLStatementType.DDL),
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 bf13d37bcb1..750d00b0523 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
@@ -360,6 +360,18 @@ dropFunction
     : DROP FUNCTION ifExists? functionName
     ;
 
+createFile
+    : CREATE FILE fileName ((FROM | IN) databaseName)? propertiesClause
+    ;
+
+dropFile
+    : DROP FILE fileName ((FROM | IN) databaseName)? propertiesClause
+    ;
+
+fileName
+    : identifier | SINGLE_QUOTED_TEXT | DOUBLE_QUOTED_TEXT
+    ;
+
 createProcedure
     : CREATE ownerStatement?
       PROCEDURE functionName LP_ procedureParameter? (COMMA_ 
procedureParameter)* RP_
diff --git 
a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
 
b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
index 348278f39fa..bebe296e063 100644
--- 
a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
+++ 
b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
@@ -141,6 +141,8 @@ execute
     | dropSqlBlockRule
     | buildIndex
     | cancelBuildIndex
+    | createFile
+    | dropFile
     // TODO consider refactor following sytax to SEMI_? EOF
     ) (SEMI_ EOF? | EOF)
     | EOF
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 13f2946046a..06c9cef0c43 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
@@ -120,6 +120,9 @@ import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameP
 import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterStoragePolicyContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateEncryptKeyContext;
+import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateFileContext;
+import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropFileContext;
+import 
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FileNameContext;
 import 
org.apache.shardingsphere.sql.parser.engine.doris.visitor.statement.DorisStatementVisitor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.enums.AlgorithmOption;
 import 
org.apache.shardingsphere.sql.parser.statement.core.enums.LockTableOption;
@@ -205,6 +208,8 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.vi
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateViewStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.DropViewStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropEncryptKeyStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFileStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFileStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.DeleteStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.InsertStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
@@ -408,6 +413,42 @@ public final class DorisDDLStatementVisitor extends 
DorisStatementVisitor implem
         return visit(ctx.tableName());
     }
     
+    @Override
+    public ASTNode visitCreateFile(final CreateFileContext ctx) {
+        CreateFileStatement result = new 
CreateFileStatement(getDatabaseType());
+        result.setFileName(getFileName(ctx.fileName()));
+        if (null != ctx.databaseName()) {
+            result.setDatabaseName(new 
IdentifierValue(ctx.databaseName().getText()).getValue());
+        }
+        if (null != ctx.propertiesClause()) {
+            
result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+        }
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitDropFile(final DropFileContext ctx) {
+        DropFileStatement result = new DropFileStatement(getDatabaseType());
+        result.setFileName(getFileName(ctx.fileName()));
+        if (null != ctx.databaseName()) {
+            result.setDatabaseName(new 
IdentifierValue(ctx.databaseName().getText()).getValue());
+        }
+        if (null != ctx.propertiesClause()) {
+            
result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+        }
+        return result;
+    }
+    
+    private String getFileName(final FileNameContext ctx) {
+        if (null != ctx.identifier()) {
+            return new IdentifierValue(ctx.identifier().getText()).getValue();
+        }
+        if (null != ctx.SINGLE_QUOTED_TEXT()) {
+            return 
SQLUtils.getExactlyValue(ctx.SINGLE_QUOTED_TEXT().getText());
+        }
+        return SQLUtils.getExactlyValue(ctx.DOUBLE_QUOTED_TEXT().getText());
+    }
+    
     @SuppressWarnings("unchecked")
     @Override
     public ASTNode visitAlterTable(final AlterTableContext ctx) {
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFileStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFileStatement.java
new file mode 100644
index 00000000000..44eb814ae32
--- /dev/null
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFileStatement.java
@@ -0,0 +1,42 @@
+/*
+ * 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.statement.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement;
+
+/**
+ * Create file statement.
+ */
+@Getter
+@Setter
+public final class CreateFileStatement extends DDLStatement {
+    
+    private String fileName;
+    
+    private String databaseName;
+    
+    private PropertiesSegment properties;
+    
+    public CreateFileStatement(final DatabaseType databaseType) {
+        super(databaseType);
+    }
+}
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropFileStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropFileStatement.java
new file mode 100644
index 00000000000..2fc8c1734d5
--- /dev/null
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropFileStatement.java
@@ -0,0 +1,42 @@
+/*
+ * 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.statement.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement;
+
+/**
+ * Drop file statement.
+ */
+@Getter
+@Setter
+public final class DropFileStatement extends DDLStatement {
+    
+    private String fileName;
+    
+    private String databaseName;
+    
+    private PropertiesSegment properties;
+    
+    public DropFileStatement(final DatabaseType databaseType) {
+        super(databaseType);
+    }
+}
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 bdb636a4cb6..f68236c06af 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
@@ -45,6 +45,8 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.vi
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateViewStatement;
 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.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;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.AlterCatalogStatementAssert;
@@ -60,6 +62,8 @@ 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.CreateSequenceStatementAssert;
 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.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;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.standard.type.DropTableStatementAssert;
@@ -97,6 +101,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.ddl.standard.view.CreateViewStatementTestCase;
 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.DropFileStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.plsql.CreateProcedureTestCase;
 
 /**
@@ -165,6 +171,10 @@ public final class StandardDDLStatementAssert {
             BuildIndexStatementAssert.assertIs(assertContext, 
(BuildIndexStatement) actual, (BuildIndexStatementTestCase) expected);
         } else if (actual instanceof CancelBuildIndexStatement) {
             CancelBuildIndexStatementAssert.assertIs(assertContext, 
(CancelBuildIndexStatement) actual, (CancelBuildIndexStatementTestCase) 
expected);
+        } else if (actual instanceof CreateFileStatement) {
+            CreateFileStatementAssert.assertIs(assertContext, 
(CreateFileStatement) actual, (CreateFileStatementTestCase) expected);
+        } else if (actual instanceof DropFileStatement) {
+            DropFileStatementAssert.assertIs(assertContext, 
(DropFileStatement) actual, (DropFileStatementTestCase) expected);
         }
     }
 }
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CreateFileStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CreateFileStatementAssert.java
new file mode 100644
index 00000000000..67a068fdc01
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CreateFileStatementAssert.java
@@ -0,0 +1,87 @@
+/*
+ * 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.segment.ddl.property.PropertySegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFileStatement;
+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.segment.impl.distsql.ExpectedProperty;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.CreateFileStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+/**
+ * Create file statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CreateFileStatementAssert {
+    
+    /**
+     * Assert create file statement is correct with expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual create file statement
+     * @param expected expected create file statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final CreateFileStatement actual, final CreateFileStatementTestCase expected) {
+        assertFileName(assertContext, actual, expected);
+        assertDatabaseName(assertContext, actual, expected);
+        assertProperties(assertContext, actual, expected);
+    }
+    
+    private static void assertFileName(final SQLCaseAssertContext 
assertContext, final CreateFileStatement actual, final 
CreateFileStatementTestCase expected) {
+        if (null == expected.getFileName()) {
+            assertNull(actual.getFileName(), assertContext.getText("File name 
should be null"));
+        } else {
+            assertNotNull(actual.getFileName(), assertContext.getText("File 
name should not be null"));
+            assertThat(assertContext.getText("File name assertion error: "), 
actual.getFileName(), is(expected.getFileName()));
+        }
+    }
+    
+    private static void assertDatabaseName(final SQLCaseAssertContext 
assertContext, final CreateFileStatement actual, final 
CreateFileStatementTestCase expected) {
+        if (null == expected.getDatabaseName()) {
+            assertNull(actual.getDatabaseName(), 
assertContext.getText("Database name should be null"));
+        } else {
+            assertNotNull(actual.getDatabaseName(), 
assertContext.getText("Database name should not be null"));
+            assertThat(assertContext.getText("Database name assertion error: 
"), actual.getDatabaseName(), is(expected.getDatabaseName()));
+        }
+    }
+    
+    private static void assertProperties(final SQLCaseAssertContext 
assertContext, final CreateFileStatement actual, final 
CreateFileStatementTestCase expected) {
+        assertNotNull(expected.getProperties(), 
assertContext.getText("Expected properties should not be null"));
+        assertNotNull(actual.getProperties(), assertContext.getText("Actual 
properties should not be null"));
+        SQLSegmentAssert.assertIs(assertContext, actual.getProperties(), 
expected.getProperties());
+        assertThat(assertContext.getText("Properties size assertion error: "),
+                actual.getProperties().getProperties().size(), 
is(expected.getProperties().getProperties().size()));
+        for (int i = 0; i < expected.getProperties().getProperties().size(); 
i++) {
+            assertProperty(assertContext, 
actual.getProperties().getProperties().get(i), 
expected.getProperties().getProperties().get(i));
+        }
+    }
+    
+    private static void assertProperty(final SQLCaseAssertContext 
assertContext, final PropertySegment actual, final ExpectedProperty expected) {
+        assertThat(assertContext.getText(String.format("Property key '%s' 
assertion error: ", expected.getKey())), actual.getKey(), 
is(expected.getKey()));
+        assertThat(assertContext.getText(String.format("Property value for key 
'%s' assertion error: ", expected.getKey())), actual.getValue(), 
is(expected.getValue()));
+        SQLSegmentAssert.assertIs(assertContext, actual, expected);
+    }
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropFileStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropFileStatementAssert.java
new file mode 100644
index 00000000000..be59eb87b12
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/DropFileStatementAssert.java
@@ -0,0 +1,87 @@
+/*
+ * 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.segment.ddl.property.PropertySegment;
+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.asserts.segment.SQLSegmentAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.distsql.ExpectedProperty;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.DropFileStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+/**
+ * Drop file statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DropFileStatementAssert {
+    
+    /**
+     * Assert drop file statement is correct with expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual drop file statement
+     * @param expected expected drop file statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final DropFileStatement actual, final DropFileStatementTestCase expected) {
+        assertFileName(assertContext, actual, expected);
+        assertDatabaseName(assertContext, actual, expected);
+        assertProperties(assertContext, actual, expected);
+    }
+    
+    private static void assertFileName(final SQLCaseAssertContext 
assertContext, final DropFileStatement actual, final DropFileStatementTestCase 
expected) {
+        if (null == expected.getFileName()) {
+            assertNull(actual.getFileName(), assertContext.getText("File name 
should be null"));
+        } else {
+            assertNotNull(actual.getFileName(), assertContext.getText("File 
name should not be null"));
+            assertThat(assertContext.getText("File name assertion error: "), 
actual.getFileName(), is(expected.getFileName()));
+        }
+    }
+    
+    private static void assertDatabaseName(final SQLCaseAssertContext 
assertContext, final DropFileStatement actual, final DropFileStatementTestCase 
expected) {
+        if (null == expected.getDatabaseName()) {
+            assertNull(actual.getDatabaseName(), 
assertContext.getText("Database name should be null"));
+        } else {
+            assertNotNull(actual.getDatabaseName(), 
assertContext.getText("Database name should not be null"));
+            assertThat(assertContext.getText("Database name assertion error: 
"), actual.getDatabaseName(), is(expected.getDatabaseName()));
+        }
+    }
+    
+    private static void assertProperties(final SQLCaseAssertContext 
assertContext, final DropFileStatement actual, final DropFileStatementTestCase 
expected) {
+        assertNotNull(expected.getProperties(), 
assertContext.getText("Expected properties should not be null"));
+        assertNotNull(actual.getProperties(), assertContext.getText("Actual 
properties should not be null"));
+        SQLSegmentAssert.assertIs(assertContext, actual.getProperties(), 
expected.getProperties());
+        assertThat(assertContext.getText("Properties size assertion error: "),
+                actual.getProperties().getProperties().size(), 
is(expected.getProperties().getProperties().size()));
+        for (int i = 0; i < expected.getProperties().getProperties().size(); 
i++) {
+            assertProperty(assertContext, 
actual.getProperties().getProperties().get(i), 
expected.getProperties().getProperties().get(i));
+        }
+    }
+    
+    private static void assertProperty(final SQLCaseAssertContext 
assertContext, final PropertySegment actual, final ExpectedProperty expected) {
+        assertThat(assertContext.getText(String.format("Property key '%s' 
assertion error: ", expected.getKey())), actual.getKey(), 
is(expected.getKey()));
+        assertThat(assertContext.getText(String.format("Property value for key 
'%s' assertion error: ", expected.getKey())), actual.getValue(), 
is(expected.getValue()));
+        SQLSegmentAssert.assertIs(assertContext, actual, expected);
+    }
+}
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 3eadd7ab9bb..9bd7ec20af3 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
@@ -114,6 +114,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.dcl.standard.RevertStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dcl.standard.RevokeStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dcl.standard.SetRoleStatementTestCase;
+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.DropFileStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.opengauss.OpengaussAlterDirectoryStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.oracle.OracleAlterAuditPolicyStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.oracle.OracleAlterHierarchyStatementTestCase;
@@ -1204,6 +1206,12 @@ public final class RootSQLParserTestCases {
     @XmlElement(name = "drop-schema")
     private final List<DropSchemaStatementTestCase> dropSchemaTestCases = new 
LinkedList<>();
     
+    @XmlElement(name = "create-file")
+    private final List<CreateFileStatementTestCase> 
createFileStatementTestCases = new LinkedList<>();
+    
+    @XmlElement(name = "drop-file")
+    private final List<DropFileStatementTestCase> dropFileStatementTestCases = 
new LinkedList<>();
+    
     @XmlElement(name = "install-component")
     private final List<MySQLInstallComponentStatementTestCase> 
installComponentTestCases = new LinkedList<>();
     
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/CreateFileStatementTestCase.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/CreateFileStatementTestCase.java
new file mode 100644
index 00000000000..78ea2e34a1d
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/CreateFileStatementTestCase.java
@@ -0,0 +1,43 @@
+/*
+ * 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.cases.parser.jaxb.statement.ddl;
+
+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.distsql.ExpectedProperties;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Create file statement test case.
+ */
+@Getter
+@Setter
+public final class CreateFileStatementTestCase extends SQLParserTestCase {
+    
+    @XmlAttribute(name = "file-name")
+    private String fileName;
+    
+    @XmlAttribute(name = "database-name")
+    private String databaseName;
+    
+    @XmlElement(name = "properties")
+    private ExpectedProperties properties;
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropFileStatementTestCase.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropFileStatementTestCase.java
new file mode 100644
index 00000000000..5d8fa96b222
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/DropFileStatementTestCase.java
@@ -0,0 +1,43 @@
+/*
+ * 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.cases.parser.jaxb.statement.ddl;
+
+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.distsql.ExpectedProperties;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Drop file statement test case.
+ */
+@Getter
+@Setter
+public final class DropFileStatementTestCase extends SQLParserTestCase {
+    
+    @XmlAttribute(name = "file-name")
+    private String fileName;
+    
+    @XmlAttribute(name = "database-name")
+    private String databaseName;
+    
+    @XmlElement(name = "properties")
+    private ExpectedProperties properties;
+}
diff --git a/test/it/parser/src/main/resources/case/ddl/create-file.xml 
b/test/it/parser/src/main/resources/case/ddl/create-file.xml
new file mode 100644
index 00000000000..6b24973110f
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/create-file.xml
@@ -0,0 +1,55 @@
+<?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>
+    <create-file sql-case-id="create_file_basic" file-name="my_file">
+        <properties start-index="20" stop-index="106">
+            <property key="url" 
value="https://test.bj.bcebos.com/kafka-key/ca.pem"; start-index="32" 
stop-index="84" />
+            <property key="catalog" value="kafka" start-index="87" 
stop-index="105" />
+        </properties>
+    </create-file>
+
+    <create-file sql-case-id="create_file_quoted" file-name="ca.pem">
+        <properties start-index="21" stop-index="107">
+            <property key="url" 
value="https://test.bj.bcebos.com/kafka-key/ca.pem"; start-index="33" 
stop-index="85" />
+            <property key="catalog" value="kafka" start-index="88" 
stop-index="106" />
+        </properties>
+    </create-file>
+
+    <create-file sql-case-id="create_file_single_quoted" file-name="ca.pem">
+        <properties start-index="21" stop-index="107">
+            <property key="url" 
value="https://test.bj.bcebos.com/kafka-key/ca.pem"; start-index="33" 
stop-index="85" />
+            <property key="catalog" value="kafka" start-index="88" 
stop-index="106" />
+        </properties>
+    </create-file>
+
+    <create-file sql-case-id="create_file_in_database" file-name="ca.pem" 
database-name="my_database">
+        <properties start-index="36" stop-index="166">
+            <property key="url" 
value="https://test.bj.bcebos.com/kafka-key/ca.pem"; start-index="48" 
stop-index="100" />
+            <property key="catalog" value="kafka" start-index="103" 
stop-index="121" />
+            <property key="md5" value="b5bb901bf10f99205b39a46ac3557dd9" 
start-index="124" stop-index="165" />
+        </properties>
+    </create-file>
+
+    <create-file sql-case-id="create_file_from_database" file-name="my_file" 
database-name="test_db">
+        <properties start-index="33" stop-index="119">
+            <property key="url" 
value="https://test.bj.bcebos.com/kafka-key/ca.pem"; start-index="45" 
stop-index="97" />
+            <property key="catalog" value="kafka" start-index="100" 
stop-index="118" />
+        </properties>
+    </create-file>
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/drop-file.xml 
b/test/it/parser/src/main/resources/case/ddl/drop-file.xml
new file mode 100644
index 00000000000..824a140e14e
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/drop-file.xml
@@ -0,0 +1,50 @@
+<?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>
+    <drop-file sql-case-id="drop_file_basic" file-name="my_file">
+        <properties start-index="18" stop-index="49">
+            <property key="catalog" value="kafka" start-index="30" 
stop-index="48" />
+        </properties>
+    </drop-file>
+
+    <drop-file sql-case-id="drop_file_quoted" file-name="ca.pem">
+        <properties start-index="19" stop-index="52">
+            <property key="catalog" value="default" start-index="31" 
stop-index="51" />
+        </properties>
+    </drop-file>
+
+    <drop-file sql-case-id="drop_file_single_quoted" file-name="ca.pem">
+        <properties start-index="19" stop-index="52">
+            <property key="catalog" value="default" start-index="31" 
stop-index="51" />
+        </properties>
+    </drop-file>
+
+    <drop-file sql-case-id="drop_file_in_database" file-name="ca.pem" 
database-name="my_database">
+        <properties start-index="34" stop-index="67">
+            <property key="catalog" value="default" start-index="46" 
stop-index="66" />
+        </properties>
+    </drop-file>
+
+    <drop-file sql-case-id="drop_file_from_database" file-name="my_file" 
database-name="test_db">
+        <properties start-index="31" stop-index="80">
+            <property key="catalog" value="default" start-index="43" 
stop-index="63" />
+            <property key="key" value="true" start-index="66" stop-index="79" 
/>
+        </properties>
+    </drop-file>
+</sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/ddl/create-file.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/create-file.xml
new file mode 100644
index 00000000000..8518d911945
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-file.xml
@@ -0,0 +1,25 @@
+<?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-cases>
+    <sql-case id="create_file_basic" value="CREATE FILE my_file PROPERTIES 
(&quot;url&quot; = &quot;https://test.bj.bcebos.com/kafka-key/ca.pem&quot;, 
&quot;catalog&quot; = &quot;kafka&quot;)" db-types="Doris" />
+    <sql-case id="create_file_quoted" value="CREATE FILE &quot;ca.pem&quot; 
PROPERTIES (&quot;url&quot; = 
&quot;https://test.bj.bcebos.com/kafka-key/ca.pem&quot;, &quot;catalog&quot; = 
&quot;kafka&quot;)" db-types="Doris" />
+    <sql-case id="create_file_single_quoted" value="CREATE FILE 'ca.pem' 
PROPERTIES (&quot;url&quot; = 
&quot;https://test.bj.bcebos.com/kafka-key/ca.pem&quot;, &quot;catalog&quot; = 
&quot;kafka&quot;)" db-types="Doris" />
+    <sql-case id="create_file_in_database" value="CREATE FILE 
&quot;ca.pem&quot; IN my_database PROPERTIES (&quot;url&quot; = 
&quot;https://test.bj.bcebos.com/kafka-key/ca.pem&quot;, &quot;catalog&quot; = 
&quot;kafka&quot;, &quot;md5&quot; = 
&quot;b5bb901bf10f99205b39a46ac3557dd9&quot;)" db-types="Doris" />
+    <sql-case id="create_file_from_database" value="CREATE FILE my_file FROM 
test_db PROPERTIES (&quot;url&quot; = 
&quot;https://test.bj.bcebos.com/kafka-key/ca.pem&quot;, &quot;catalog&quot; = 
&quot;kafka&quot;)" db-types="Doris" />
+</sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/drop-file.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/drop-file.xml
new file mode 100644
index 00000000000..c4b78e29a71
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/drop-file.xml
@@ -0,0 +1,25 @@
+<?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-cases>
+    <sql-case id="drop_file_basic" value="DROP FILE my_file PROPERTIES 
(&quot;catalog&quot; = &quot;kafka&quot;)" db-types="Doris" />
+    <sql-case id="drop_file_quoted" value="DROP FILE &quot;ca.pem&quot; 
PROPERTIES (&quot;catalog&quot; = &quot;default&quot;)" db-types="Doris" />
+    <sql-case id="drop_file_single_quoted" value="DROP FILE 'ca.pem' 
PROPERTIES (&quot;catalog&quot; = &quot;default&quot;)" db-types="Doris" />
+    <sql-case id="drop_file_in_database" value="DROP FILE &quot;ca.pem&quot; 
IN my_database PROPERTIES (&quot;catalog&quot; = &quot;default&quot;)" 
db-types="Doris" />
+    <sql-case id="drop_file_from_database" value="DROP FILE my_file FROM 
test_db PROPERTIES (&quot;catalog&quot; = &quot;default&quot;, &quot;key&quot; 
= &quot;true&quot;)" db-types="Doris" />
+</sql-cases>


Reply via email to