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 a8b5c61d472 Add DialectPipelineNativeContainerDropTableOption (#36609)
a8b5c61d472 is described below
commit a8b5c61d4720866b336c8e07c757da335f1fa9dd
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Sep 18 13:32:13 2025 +0800
Add DialectPipelineNativeContainerDropTableOption (#36609)
* Add DialectPipelineNativeContainerDropTableOption
* Add DialectPipelineNativeContainerDropTableOption
---
.../pipeline/cases/PipelineContainerComposer.java | 4 +-
.../compose/PipelineNativeContainerComposer.java | 137 ---------------------
.../PipelineDockerContainerComposer.java | 3 +-
...lectPipelineNativeContainerDropTableOption.java | 56 +++++++++
.../natived/PipelineNativeContainerComposer.java | 101 +++++++++++++++
...iaDBPipelineNativeContainerDropTableOption.java | 51 ++++++++
...ySQLPipelineNativeContainerDropTableOption.java | 53 ++++++++
...aussPipelineNativeContainerDropTableOption.java | 51 ++++++++
...aclePipelineNativeContainerDropTableOption.java | 49 ++++++++
...eSQLPipelineNativeContainerDropTableOption.java | 49 ++++++++
...d.DialectPipelineNativeContainerDropTableOption | 22 ++++
11 files changed, 436 insertions(+), 140 deletions(-)
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
index 627e681f133..3b8a0360664 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
@@ -51,8 +51,8 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvi
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineBaseContainerComposer;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineDockerContainerComposer;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineNativeContainerComposer;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.docker.PipelineDockerContainerComposer;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.PipelineNativeContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.awaitility.Awaitility;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineNativeContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineNativeContainerComposer.java
deleted file mode 100644
index 90172653b19..00000000000
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineNativeContainerComposer.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.e2e.operation.pipeline.framework.container.compose;
-
-import lombok.SneakyThrows;
-import
org.apache.shardingsphere.database.connector.core.jdbcurl.appender.JdbcUrlAppender;
-import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
-import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
-import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.ProxyDatabaseTypeUtils;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Pipeline native composed container, need to start ShardingSphere-Proxy at
firstly.
- */
-public final class PipelineNativeContainerComposer extends
PipelineBaseContainerComposer {
-
- private static final PipelineE2EEnvironment ENV =
PipelineE2EEnvironment.getInstance();
-
- private final DatabaseType databaseType;
-
- public PipelineNativeContainerComposer(final DatabaseType databaseType) {
- this.databaseType = databaseType;
- }
-
- @SneakyThrows(SQLException.class)
- @Override
- public void cleanUpDatabase(final String databaseName) {
- int actualDatabasePort = ENV.getActualDatabasePort(databaseType);
- String username = ENV.getActualDataSourceUsername(databaseType);
- String password = ENV.getActualDataSourcePassword(databaseType);
- DataSourceEnvironment dataSourceEnvironment =
DatabaseTypedSPILoader.getService(DataSourceEnvironment.class, databaseType);
- String jdbcUrl;
- switch (databaseType.getType()) {
- case "MySQL":
- case "MariaDB":
- jdbcUrl = new
JdbcUrlAppender().appendQueryProperties(dataSourceEnvironment.getURL("localhost",
actualDatabasePort, databaseName),
- PropertiesBuilder.build(new
Property("allowPublicKeyRetrieval", Boolean.TRUE.toString())));
- try (Connection connection =
DriverManager.getConnection(jdbcUrl, username, password)) {
- dropTableWithMySQL(connection, databaseName);
- }
- break;
- case "openGauss":
- case "PostgreSQL":
- jdbcUrl = dataSourceEnvironment.getURL("localhost",
actualDatabasePort, databaseName);
- try (Connection connection =
DriverManager.getConnection(jdbcUrl, username, password)) {
- dropTableWithPostgreSQL(connection);
- }
- break;
- case "Oracle":
- jdbcUrl = dataSourceEnvironment.getURL("localhost",
actualDatabasePort, "");
- try (Connection connection =
DriverManager.getConnection(jdbcUrl, username, password)) {
- dropTableWithOracle(connection, databaseName);
- }
- break;
- default:
- }
- }
-
- private void dropTableWithMySQL(final Connection connection, final String
databaseName) throws SQLException {
- String queryAllTables = String.format("SELECT table_name FROM
information_schema.tables WHERE table_schema='%s' and table_type='BASE TABLE'",
databaseName);
- try (ResultSet resultSet =
connection.createStatement().executeQuery(queryAllTables)) {
- List<String> actualTableNames =
getFirstColumnValueFromResult(resultSet);
- for (String each : actualTableNames) {
- connection.createStatement().executeUpdate(String.format("DROP
TABLE %s", each));
- }
- }
- }
-
- private List<String> getFirstColumnValueFromResult(final ResultSet
resultSet) throws SQLException {
- List<String> result = new LinkedList<>();
- while (resultSet.next()) {
- result.add(resultSet.getString(1));
- }
- return result;
- }
-
- private void dropTableWithPostgreSQL(final Connection connection) throws
SQLException {
- dropTableWithPostgreSQL(connection, "public");
- dropTableWithPostgreSQL(connection, "test");
- connection.createStatement().execute("DROP SCHEMA IF EXISTS test;");
- }
-
- private void dropTableWithPostgreSQL(final Connection connection, final
String schema) throws SQLException {
- String queryAllTables = "SELECT tablename FROM pg_tables WHERE='%s'";
- try (ResultSet resultSet =
connection.createStatement().executeQuery(String.format(queryAllTables,
schema))) {
- List<String> actualTableNames =
getFirstColumnValueFromResult(resultSet);
- for (String each : actualTableNames) {
- connection.createStatement().executeUpdate(String.format("DROP
TABLE %s.%s", schema, each));
- }
- }
- }
-
- private void dropTableWithOracle(final Connection connection, final String
schema) throws SQLException {
- String queryAllTables = String.format("SELECT TABLE_NAME FROM
ALL_TABLES WHERE OWNER='%s'", schema);
- try (ResultSet resultSet =
connection.createStatement().executeQuery(String.format(queryAllTables,
schema))) {
- List<String> actualTableNames =
getFirstColumnValueFromResult(resultSet);
- for (String each : actualTableNames) {
- connection.createStatement().executeUpdate(String.format("DROP
TABLE %s.%s", schema, each));
- }
- }
- }
-
- @Override
- public String getProxyJdbcUrl(final String databaseName) {
- return DatabaseTypedSPILoader.getService(DataSourceEnvironment.class,
ProxyDatabaseTypeUtils.getProxyDatabaseType(databaseType)).getURL("localhost",
3307, databaseName);
- }
-
- @Override
- public int getProxyCDCPort() {
- return 33071;
- }
-}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineDockerContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
similarity index 97%
rename from
test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineDockerContainerComposer.java
rename to
test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
index 1e40ea0d3fd..34244d71932 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/PipelineDockerContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose;
+package
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.docker;
import lombok.Getter;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
@@ -32,6 +32,7 @@ import
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.type.dock
import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineBaseContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.config.proxy.PipelineProxyContainerConfigurationFactory;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.ProxyDatabaseTypeUtils;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/DialectPipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/DialectPipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..dd35b787f60
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/DialectPipelineNativeContainerDropTableOption.java
@@ -0,0 +1,56 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived;
+
+import org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPI;
+import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+
+import java.util.Optional;
+
+/**
+ * Dialect pipeline native container drop table option.
+ */
+@SingletonSPI
+public interface DialectPipelineNativeContainerDropTableOption extends
DatabaseTypedSPI {
+
+ /**
+ * Get JDBC URL.
+ *
+ * @param dataSourceEnvironment data source environment
+ * @param actualDatabasePort actual database port
+ * @param databaseName database name
+ * @return JDBC URL
+ */
+ String getJdbcUrl(DataSourceEnvironment dataSourceEnvironment, int
actualDatabasePort, String databaseName);
+
+ /**
+ * Get query all schema and table mapper SQL.
+ *
+ * @param databaseName database name
+ * @return query all schema and table mapper SQL
+ */
+ String getQueryAllSchemaAndTableMapperSQL(String databaseName);
+
+ /**
+ * Get drop schema SQL.
+ *
+ * @return drop schema SQL
+ */
+ Optional<String> getDropSchemaSQL();
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/PipelineNativeContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/PipelineNativeContainerComposer.java
new file mode 100644
index 00000000000..c39cce2bc28
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/PipelineNativeContainerComposer.java
@@ -0,0 +1,101 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived;
+
+import lombok.SneakyThrows;
+import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineBaseContainerComposer;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.ProxyDatabaseTypeUtils;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+
+/**
+ * Pipeline native composed container, need to start ShardingSphere-Proxy at
firstly.
+ */
+public final class PipelineNativeContainerComposer extends
PipelineBaseContainerComposer {
+
+ private static final PipelineE2EEnvironment ENV =
PipelineE2EEnvironment.getInstance();
+
+ private final DatabaseType databaseType;
+
+ private final DialectPipelineNativeContainerDropTableOption
dropTableOption;
+
+ public PipelineNativeContainerComposer(final DatabaseType databaseType) {
+ this.databaseType = databaseType;
+ dropTableOption =
DatabaseTypedSPILoader.getService(DialectPipelineNativeContainerDropTableOption.class,
databaseType);
+ }
+
+ @SneakyThrows(SQLException.class)
+ @Override
+ public void cleanUpDatabase(final String databaseName) {
+ int actualDatabasePort = ENV.getActualDatabasePort(databaseType);
+ String username = ENV.getActualDataSourceUsername(databaseType);
+ String password = ENV.getActualDataSourcePassword(databaseType);
+ String jdbcUrl =
dropTableOption.getJdbcUrl(DatabaseTypedSPILoader.getService(DataSourceEnvironment.class,
databaseType), actualDatabasePort, databaseName);
+ try (Connection connection = DriverManager.getConnection(jdbcUrl,
username, password)) {
+ dropTable(connection, databaseName);
+ }
+ }
+
+ private void dropTable(final Connection connection, final String
databaseName) throws SQLException {
+ Map<String, String> schemaAndTableMapper =
getSchemaAndTableMapper(connection, databaseName);
+ try (Statement statement = connection.createStatement()) {
+ for (Entry<String, String> entry :
schemaAndTableMapper.entrySet()) {
+ statement.executeUpdate(String.format("DROP TABLE %s.%s",
entry.getKey(), entry.getValue()));
+ }
+ Optional<String> dropSchemaSQL =
dropTableOption.getDropSchemaSQL();
+ if (dropSchemaSQL.isPresent()) {
+ statement.executeUpdate(dropSchemaSQL.get());
+ }
+ }
+ }
+
+ @SuppressWarnings("CollectionWithoutInitialCapacity")
+ private Map<String, String> getSchemaAndTableMapper(final Connection
connection, final String databaseName) throws SQLException {
+ Map<String, String> result = new HashMap<>();
+ try (
+ Statement statement = connection.createStatement();
+ ResultSet resultSet =
statement.executeQuery(dropTableOption.getQueryAllSchemaAndTableMapperSQL(databaseName)))
{
+ while (resultSet.next()) {
+ result.put(resultSet.getString(1), resultSet.getString(2));
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String getProxyJdbcUrl(final String databaseName) {
+ return DatabaseTypedSPILoader.getService(DataSourceEnvironment.class,
ProxyDatabaseTypeUtils.getProxyDatabaseType(databaseType)).getURL("localhost",
3307, databaseName);
+ }
+
+ @Override
+ public int getProxyCDCPort() {
+ return 33071;
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MariaDBPipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MariaDBPipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..955fa33b3f4
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MariaDBPipelineNativeContainerDropTableOption.java
@@ -0,0 +1,51 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived.dialect;
+
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption;
+
+import java.util.Optional;
+
+/**
+ * Pipeline native container drop table option for MariaDB.
+ */
+public final class MariaDBPipelineNativeContainerDropTableOption implements
DialectPipelineNativeContainerDropTableOption {
+
+ private final DialectPipelineNativeContainerDropTableOption delegated =
new MySQLPipelineNativeContainerDropTableOption();
+
+ @Override
+ public String getJdbcUrl(final DataSourceEnvironment
dataSourceEnvironment, final int actualDatabasePort, final String databaseName)
{
+ return delegated.getJdbcUrl(dataSourceEnvironment, actualDatabasePort,
databaseName);
+ }
+
+ @Override
+ public String getQueryAllSchemaAndTableMapperSQL(final String
databaseName) {
+ return delegated.getQueryAllSchemaAndTableMapperSQL(databaseName);
+ }
+
+ @Override
+ public Optional<String> getDropSchemaSQL() {
+ return delegated.getDropSchemaSQL();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "MariaDB";
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MySQLPipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MySQLPipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..0676b052c00
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/MySQLPipelineNativeContainerDropTableOption.java
@@ -0,0 +1,53 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived.dialect;
+
+import
org.apache.shardingsphere.database.connector.core.jdbcurl.appender.JdbcUrlAppender;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption;
+
+import java.util.Optional;
+
+/**
+ * Pipeline native container drop table option for MySQL.
+ */
+public final class MySQLPipelineNativeContainerDropTableOption implements
DialectPipelineNativeContainerDropTableOption {
+
+ @Override
+ public String getJdbcUrl(final DataSourceEnvironment
dataSourceEnvironment, final int actualDatabasePort, final String databaseName)
{
+ return new
JdbcUrlAppender().appendQueryProperties(dataSourceEnvironment.getURL("localhost",
actualDatabasePort, databaseName),
+ PropertiesBuilder.build(new
Property("allowPublicKeyRetrieval", Boolean.TRUE.toString())));
+ }
+
+ @Override
+ public String getQueryAllSchemaAndTableMapperSQL(final String
databaseName) {
+ return String.format("SELECT table_schema, table_name FROM
information_schema.tables WHERE table_schema='%s' AND table_type='BASE TABLE'",
databaseName);
+ }
+
+ @Override
+ public Optional<String> getDropSchemaSQL() {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "MySQL";
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OpenGaussPipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OpenGaussPipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..9e5bed2ee75
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OpenGaussPipelineNativeContainerDropTableOption.java
@@ -0,0 +1,51 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived.dialect;
+
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption;
+
+import java.util.Optional;
+
+/**
+ * Pipeline native container drop table option for openGauss.
+ */
+public final class OpenGaussPipelineNativeContainerDropTableOption implements
DialectPipelineNativeContainerDropTableOption {
+
+ private final DialectPipelineNativeContainerDropTableOption delegated =
new PostgreSQLPipelineNativeContainerDropTableOption();
+
+ @Override
+ public String getJdbcUrl(final DataSourceEnvironment
dataSourceEnvironment, final int actualDatabasePort, final String databaseName)
{
+ return delegated.getJdbcUrl(dataSourceEnvironment, actualDatabasePort,
databaseName);
+ }
+
+ @Override
+ public String getQueryAllSchemaAndTableMapperSQL(final String
databaseName) {
+ return delegated.getQueryAllSchemaAndTableMapperSQL(databaseName);
+ }
+
+ @Override
+ public Optional<String> getDropSchemaSQL() {
+ return delegated.getDropSchemaSQL();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "openGauss";
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OraclePipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OraclePipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..8fc7b9aca57
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/OraclePipelineNativeContainerDropTableOption.java
@@ -0,0 +1,49 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived.dialect;
+
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption;
+
+import java.util.Optional;
+
+/**
+ * Pipeline native container drop table option for Oracle.
+ */
+public final class OraclePipelineNativeContainerDropTableOption implements
DialectPipelineNativeContainerDropTableOption {
+
+ @Override
+ public String getJdbcUrl(final DataSourceEnvironment
dataSourceEnvironment, final int actualDatabasePort, final String databaseName)
{
+ return dataSourceEnvironment.getURL("localhost", actualDatabasePort,
"");
+ }
+
+ @Override
+ public String getQueryAllSchemaAndTableMapperSQL(final String
databaseName) {
+ return String.format("SELECT OWNER, TABLE_NAME FROM ALL_TABLES WHERE
OWNER='%s'", databaseName);
+ }
+
+ @Override
+ public Optional<String> getDropSchemaSQL() {
+ return Optional.empty();
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "Oracle";
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/PostgreSQLPipelineNativeContainerDropTableOption.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/PostgreSQLPipelineNativeContainerDropTableOption.java
new file mode 100644
index 00000000000..083363f0baa
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/natived/dialect/PostgreSQLPipelineNativeContainerDropTableOption.java
@@ -0,0 +1,49 @@
+/*
+ * 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.e2e.operation.pipeline.framework.container.compose.natived.dialect;
+
+import
org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption;
+
+import java.util.Optional;
+
+/**
+ * Pipeline native container drop table option for PostgreSQL.
+ */
+public final class PostgreSQLPipelineNativeContainerDropTableOption implements
DialectPipelineNativeContainerDropTableOption {
+
+ @Override
+ public String getJdbcUrl(final DataSourceEnvironment
dataSourceEnvironment, final int actualDatabasePort, final String databaseName)
{
+ return dataSourceEnvironment.getURL("localhost", actualDatabasePort,
databaseName);
+ }
+
+ @Override
+ public String getQueryAllSchemaAndTableMapperSQL(final String
databaseName) {
+ return "SELECT schemaname, tablename FROM pg_tables WHERE
schemaname='public' OR schemaname='test'";
+ }
+
+ @Override
+ public Optional<String> getDropSchemaSQL() {
+ return Optional.of("DROP SCHEMA IF EXISTS test;");
+ }
+
+ @Override
+ public String getDatabaseType() {
+ return "PostgreSQL";
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/resources/META-INF/services/org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption
b/test/e2e/operation/pipeline/src/test/resources/META-INF/services/org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption
new file mode 100644
index 00000000000..fd97f16223b
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/resources/META-INF/services/org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.DialectPipelineNativeContainerDropTableOption
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.dialect.MySQLPipelineNativeContainerDropTableOption
+org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.dialect.PostgreSQLPipelineNativeContainerDropTableOption
+org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.dialect.OraclePipelineNativeContainerDropTableOption
+org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.dialect.MariaDBPipelineNativeContainerDropTableOption
+org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.dialect.OpenGaussPipelineNativeContainerDropTableOption