You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/07/15 04:31:12 UTC

[shardingsphere] branch master updated: add more CreateTableSQLGenerator it test for mysql, postgresql (#19181)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang 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 eee089563b1 add more CreateTableSQLGenerator it test for mysql, postgresql (#19181)
eee089563b1 is described below

commit eee089563b127952d0041a10dbacb353222779ff
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Fri Jul 15 12:31:05 2022 +0800

    add more CreateTableSQLGenerator it test for mysql, postgresql (#19181)
---
 .../ddlgenerator/MySQLCreateTableSQLGenerator.java |  4 +-
 .../OpenGaussCreateTableSQLGenerator.java          |  4 +-
 ...=> CreateTableSQLGeneratorAssertionEntity.java} |  8 +-
 ...eateTableSQLGeneratorAssertionsRootEntity.java} | 10 +--
 ...ava => CreateTableSQLGeneratorInputEntity.java} |  4 +-
 ...va => CreateTableSQLGeneratorOutputEntity.java} |  4 +-
 .../CreateTableSQLGeneratorIT.java}                | 85 +++++++++++++---------
 .../mysql/create-table-sql-generator.xml           | 78 ++++++++++++++++++++
 .../opengauss/create-table-sql-generator.xml       | 68 +++++++++++++++++
 .../postgresql/create-table-sql-generator.xml}     | 12 +--
 10 files changed, 222 insertions(+), 55 deletions(-)

diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ddlgenerator/MySQLCreateTableSQLGenerator.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ddlgenerator/MySQLCreateTableSQLGenerator.java
index 1315d590d1f..6686468d0e0 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ddlgenerator/MySQLCreateTableSQLGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ddlgenerator/MySQLCreateTableSQLGenerator.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.data.pipeline.spi.ddlgenerator.CreateTableSQLGe
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 
 import javax.sql.DataSource;
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -39,7 +40,8 @@ public final class MySQLCreateTableSQLGenerator implements CreateTableSQLGenerat
     @Override
     public Collection<String> generate(final String tableName, final String schemaName, final DataSource dataSource) throws SQLException {
         try (
-                Statement statement = dataSource.getConnection().createStatement();
+                Connection connection = dataSource.getConnection();
+                Statement statement = connection.createStatement();
                 ResultSet resultSet = statement.executeQuery(String.format(SHOW_CREATE_SQL, tableName))) {
             if (resultSet.next()) {
                 return Collections.singletonList(resultSet.getString(COLUMN_LABEL));
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ddlgenerator/OpenGaussCreateTableSQLGenerator.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ddlgenerator/OpenGaussCreateTableSQLGenerator.java
index ace7935152c..ac8b4402c03 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ddlgenerator/OpenGaussCreateTableSQLGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ddlgenerator/OpenGaussCreateTableSQLGenerator.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.data.pipeline.spi.ddlgenerator.CreateTableSQLGe
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 
 import javax.sql.DataSource;
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -41,7 +42,8 @@ public final class OpenGaussCreateTableSQLGenerator implements CreateTableSQLGen
     @Override
     public Collection<String> generate(final String tableName, final String schemaName, final DataSource dataSource) throws SQLException {
         try (
-                Statement statement = dataSource.getConnection().createStatement();
+                Connection connection = dataSource.getConnection();
+                Statement statement = connection.createStatement();
                 ResultSet resultSet = statement.executeQuery(String.format(SELECT_TABLE_DEF_SQL, schemaName, tableName))) {
             if (resultSet.next()) {
                 // TODO use ";" to split is not always correct
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionEntity.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionEntity.java
similarity index 85%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionEntity.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionEntity.java
index f4f28eed31b..16bea459f69 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionEntity.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionEntity.java
@@ -27,19 +27,19 @@ import javax.xml.bind.annotation.XmlElement;
 import java.util.Collection;
 
 /**
- * DDL generator entity for JAXB.
+ * Create table sql generator entity for JAXB.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @Getter
 @Setter
-public final class DDLGeneratorAssertionEntity {
+public final class CreateTableSQLGeneratorAssertionEntity {
     
     @XmlAttribute(required = true)
     private String id;
     
     @XmlElement(required = true)
-    private DDLGeneratorInputEntity input;
+    private CreateTableSQLGeneratorInputEntity input;
     
     @XmlElement(required = true, name = "output")
-    private Collection<DDLGeneratorOutputEntity> outputs;
+    private Collection<CreateTableSQLGeneratorOutputEntity> outputs;
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionsRootEntity.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionsRootEntity.java
similarity index 76%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionsRootEntity.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionsRootEntity.java
index f6f285299e2..2e1f460b1ed 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorAssertionsRootEntity.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorAssertionsRootEntity.java
@@ -25,12 +25,12 @@ import java.util.Collection;
 import java.util.LinkedList;
 
 /**
- * DDL generator root entity for JAXB.
+ * Create table generator root entity for JAXB.
  */
-@XmlRootElement(name = "ddl-generator-assertions")
+@XmlRootElement(name = "create-table-generator-assertions")
 @Getter
-public final class DDLGeneratorAssertionsRootEntity {
+public final class CreateTableSQLGeneratorAssertionsRootEntity {
     
-    @XmlElement(name = "ddl-generator-assertion")
-    private final Collection<DDLGeneratorAssertionEntity> assertions = new LinkedList<>();
+    @XmlElement(name = "create-table-generator-assertion")
+    private final Collection<CreateTableSQLGeneratorAssertionEntity> assertions = new LinkedList<>();
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorInputEntity.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorInputEntity.java
similarity index 92%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorInputEntity.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorInputEntity.java
index a730d267e70..02e4d0084c9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorInputEntity.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorInputEntity.java
@@ -26,12 +26,12 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 
 /**
- * DDL generator input entity for JAXB.
+ * Create table sql generator input entity for JAXB.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @Getter
 @Setter
-public final class DDLGeneratorInputEntity {
+public final class CreateTableSQLGeneratorInputEntity {
     
     @XmlAttribute
     private String table;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorOutputEntity.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorOutputEntity.java
similarity index 92%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorOutputEntity.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorOutputEntity.java
index 73f85129fc5..c366fecd57d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/DDLGeneratorOutputEntity.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/CreateTableSQLGeneratorOutputEntity.java
@@ -27,12 +27,12 @@ import javax.xml.bind.annotation.XmlElement;
 import java.util.Collection;
 
 /**
- * DDL generator output entity for JAXB.
+ * Create table sql generator output entity for JAXB.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @Getter
 @Setter
-public final class DDLGeneratorOutputEntity {
+public final class CreateTableSQLGeneratorOutputEntity {
     
     @XmlAttribute
     private String version;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
similarity index 66%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
index 53b03c7bf14..7be7be51937 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
@@ -15,16 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipeline.cases.postgresql;
+package org.apache.shardingsphere.integration.data.pipeline.cases.general;
 
-import com.google.common.base.Strings;
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.shardingsphere.data.pipeline.spi.ddlgenerator.CreateTableSQLGeneratorFactory;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
-import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGeneratorAssertionEntity;
-import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGeneratorAssertionsRootEntity;
-import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGeneratorOutputEntity;
+import org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTableSQLGeneratorAssertionEntity;
+import org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTableSQLGeneratorAssertionsRootEntity;
+import org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTableSQLGeneratorOutputEntity;
 import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
 import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
 import org.apache.shardingsphere.integration.data.pipeline.factory.DatabaseContainerFactory;
@@ -52,14 +53,20 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
 @RunWith(Parameterized.class)
-public final class PostgreSQLDDLGeneratorIT {
+public final class CreateTableSQLGeneratorIT {
     
-    private static final String CASE_FILE_PATH = "ddlgenerator.xml";
+    private static final String POSTGRES_CASE_FILE_PATH = "postgresql/create-table-sql-generator.xml";
     
-    private static final String PARENT_PATH = "env/scenario/ddlgenerator/postgresql";
+    private static final String MYSQL_CASE_FILE_PATH = "mysql/create-table-sql-generator.xml";
+    
+    private static final String OPEN_GAUSS_CASE_FILE_PATH = "openGauss/create-table-sql-generator.xml";
+    
+    private static final String PARENT_PATH = "env/scenario/createtablegenerator";
     
     private static final String DEFAULT_SCHEMA = "public";
     
+    private static final String DEFAULT_DATABASE = "ds";
+    
     private static final Pattern REPLACE_LINE_SPACE = Pattern.compile("\\s*|\t|\r|\n");
     
     private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
@@ -68,12 +75,12 @@ public final class PostgreSQLDDLGeneratorIT {
     
     private final ScalingParameterized parameterized;
     
-    private final DDLGeneratorAssertionsRootEntity rootEntity;
+    private final CreateTableSQLGeneratorAssertionsRootEntity rootEntity;
     
-    public PostgreSQLDDLGeneratorIT(final ScalingParameterized parameterized) {
+    public CreateTableSQLGeneratorIT(final ScalingParameterized parameterized) {
         this.parameterized = parameterized;
-        this.rootEntity = JAXB.unmarshal(Objects.requireNonNull(PostgreSQLDDLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
-                DDLGeneratorAssertionsRootEntity.class);
+        this.rootEntity = JAXB.unmarshal(Objects.requireNonNull(CreateTableSQLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
+                CreateTableSQLGeneratorAssertionsRootEntity.class);
         this.databaseContainer = DatabaseContainerFactory.newInstance(parameterized.getDatabaseType(), parameterized.getDockerImageName());
         databaseContainer.start();
     }
@@ -85,48 +92,45 @@ public final class PostgreSQLDDLGeneratorIT {
             return result;
         }
         for (String each : ENV.getPostgresVersions()) {
-            if (!Strings.isNullOrEmpty(each)) {
-                result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), each, String.join("/", PARENT_PATH, CASE_FILE_PATH)));
-            }
+            result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), each, String.join("/", PARENT_PATH, POSTGRES_CASE_FILE_PATH)));
+        }
+        for (String each : ENV.getMysqlVersions()) {
+            result.add(new ScalingParameterized(new MySQLDatabaseType(), each, String.join("/", PARENT_PATH, MYSQL_CASE_FILE_PATH)));
+        }
+        for (String each : ENV.getOpenGaussVersions()) {
+            result.add(new ScalingParameterized(new OpenGaussDatabaseType(), each, String.join("/", PARENT_PATH, OPEN_GAUSS_CASE_FILE_PATH)));
         }
         return result;
     }
     
     @Test
-    public void assertGenerateDDLSQL() throws SQLException {
-        DataSource dataSource = createDataSource();
+    public void assertGenerateCreateTableSQL() throws SQLException {
+        initData();
+        DataSource dataSource = createDataSource(DEFAULT_DATABASE);
         try (
                 Connection connection = dataSource.getConnection();
                 Statement statement = connection.createStatement()) {
             int majorVersion = connection.getMetaData().getDatabaseMajorVersion();
-            for (DDLGeneratorAssertionEntity each : rootEntity.getAssertions()) {
+            for (CreateTableSQLGeneratorAssertionEntity each : rootEntity.getAssertions()) {
                 statement.execute(each.getInput().getSql());
                 Collection<String> multiSQL = CreateTableSQLGeneratorFactory.findInstance(parameterized.getDatabaseType())
-                        .orElseThrow(() -> new ShardingSphereException("Failed to get dialect ddl sql generator")).generate(each.getInput().getTable(), DEFAULT_SCHEMA, dataSource);
+                        .orElseThrow(() -> new ShardingSphereException("Failed to get create table sql generator")).generate(each.getInput().getTable(), DEFAULT_SCHEMA, dataSource);
                 assertIsCorrect(multiSQL, getVersionOutput(each.getOutputs(), majorVersion));
             }
         }
     }
     
-    private Collection<String> getVersionOutput(final Collection<DDLGeneratorOutputEntity> outputs, final int majorVersion) {
-        Collection<String> result = new LinkedList<>();
-        for (DDLGeneratorOutputEntity each : outputs) {
-            if ("default".equals(each.getVersion())) {
-                result = each.getMultiSQL();
-            }
-            if (String.valueOf(majorVersion).equals(each.getVersion())) {
-                return each.getMultiSQL();
-            }
-        }
-        return result;
+    private void initData() throws SQLException {
+        DataSource dataSource = createDataSource("");
+        dataSource.getConnection().createStatement().execute("CREATE DATABASE " + DEFAULT_DATABASE);
     }
     
-    private DataSource createDataSource() {
+    private DataSource createDataSource(final String databaseName) {
         HikariDataSource result = new HikariDataSource();
         result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseContainer.getDatabaseType()));
-        result.setJdbcUrl(databaseContainer.getJdbcUrl("postgres"));
-        result.setUsername("root");
-        result.setPassword("root");
+        result.setJdbcUrl(databaseContainer.getJdbcUrl(databaseName));
+        result.setUsername(databaseContainer.getUsername());
+        result.setPassword(databaseContainer.getPassword());
         result.setMaximumPoolSize(2);
         result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
         return result;
@@ -139,6 +143,19 @@ public final class PostgreSQLDDLGeneratorIT {
         }
     }
     
+    private Collection<String> getVersionOutput(final Collection<CreateTableSQLGeneratorOutputEntity> outputs, final int majorVersion) {
+        Collection<String> result = new LinkedList<>();
+        for (CreateTableSQLGeneratorOutputEntity each : outputs) {
+            if ("default".equals(each.getVersion())) {
+                result = each.getMultiSQL();
+            }
+            if (String.valueOf(majorVersion).equals(each.getVersion())) {
+                return each.getMultiSQL();
+            }
+        }
+        return result;
+    }
+    
     @After
     public void stopContainer() {
         databaseContainer.stop();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/mysql/create-table-sql-generator.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/mysql/create-table-sql-generator.xml
new file mode 100644
index 00000000000..b819b68e261
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/mysql/create-table-sql-generator.xml
@@ -0,0 +1,78 @@
+<!--
+  ~ 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.
+  -->
+
+<create-table-generator-assertions>
+    <create-table-generator-assertion id="t_order">
+        <input table="t_order">
+            <sql>
+                CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+            </sql>
+        </input>
+        <output version="default">
+            <sql>
+                CREATE TABLE `t_order` (
+                `order_id` int(11) NOT NULL,
+                `user_id` int(11) NOT NULL,
+                `status` varchar(45) DEFAULT NULL,
+                PRIMARY KEY (`order_id`)
+                ) ENGINE=InnoDB DEFAULT CHARSET=latin1
+            </sql>
+        </output>
+        <output version="8">
+            <sql>
+                CREATE TABLE `t_order` (
+                `order_id` int NOT NULL,
+                `user_id` int NOT NULL,
+                `status` varchar(45) DEFAULT NULL,
+                PRIMARY KEY (`order_id`)
+                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+            </sql>
+        </output>
+    </create-table-generator-assertion>
+
+    <create-table-generator-assertion id="t_order_item">
+        <input table="t_order_item">
+            <sql>
+                CREATE TABLE t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+            </sql>
+        </input>
+        <output version="default">
+            <sql>
+                CREATE TABLE `t_order_item` (
+                `item_id` int(11) NOT NULL,
+                `order_id` int(11) NOT NULL,
+                `user_id` int(11) NOT NULL,
+                `status` varchar(45) DEFAULT NULL,
+                `creation_date` date DEFAULT NULL,
+                PRIMARY KEY (`item_id`)
+                ) ENGINE=InnoDB DEFAULT CHARSET=latin1
+            </sql>
+        </output>
+        <output version="8">
+            <sql>
+                CREATE TABLE `t_order_item` (
+                `item_id` int NOT NULL,
+                `order_id` int NOT NULL,
+                `user_id` int NOT NULL,
+                `status` varchar(45) DEFAULT NULL,
+                `creation_date` date DEFAULT NULL,
+                PRIMARY KEY (`item_id`)
+                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+            </sql>
+        </output>
+    </create-table-generator-assertion>
+</create-table-generator-assertions>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/opengauss/create-table-sql-generator.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/opengauss/create-table-sql-generator.xml
new file mode 100644
index 00000000000..44e5826baa1
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/opengauss/create-table-sql-generator.xml
@@ -0,0 +1,68 @@
+<!--
+  ~ 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.
+  -->
+
+<create-table-generator-assertions>
+    <create-table-generator-assertion id="t_order">
+        <input table="t_order">
+            <sql>
+                CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+            </sql>
+        </input>
+        <output version="default">
+            <sql>
+                SET search_path = public
+            </sql>
+            <sql>
+                CREATE TABLE t_order (
+                order_id integer NOT NULL,
+                user_id integer NOT NULL,
+                status character varying(45)
+                )
+                WITH (orientation=row, compression=no)
+            </sql>
+            <sql>
+                ALTER TABLE t_order ADD CONSTRAINT t_order_pkey PRIMARY KEY (order_id)
+            </sql>
+        </output>
+    </create-table-generator-assertion>
+
+    <create-table-generator-assertion id="t_order_item">
+        <input table="t_order_item">
+            <sql>
+                CREATE TABLE t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+            </sql>
+        </input>
+        <output version="default">
+            <sql>
+                SET search_path = public
+            </sql>
+            <sql>
+                CREATE TABLE t_order_item (
+                item_id integer NOT NULL,
+                order_id integer NOT NULL,
+                user_id integer NOT NULL,
+                status character varying(45),
+                creation_date date
+                )
+                WITH (orientation=row, compression=no)
+            </sql>
+            <sql>
+                ALTER TABLE t_order_item ADD CONSTRAINT t_order_item_pkey PRIMARY KEY (item_id)
+            </sql>
+        </output>
+    </create-table-generator-assertion>
+</create-table-generator-assertions>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/ddlgenerator/postgresql/ddlgenerator.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/postgresql/create-table-sql-generator.xml
similarity index 94%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/ddlgenerator/postgresql/ddlgenerator.xml
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/postgresql/create-table-sql-generator.xml
index 4bf1eda5603..ea9c4f77d28 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/ddlgenerator/postgresql/ddlgenerator.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/createtablegenerator/postgresql/create-table-sql-generator.xml
@@ -15,8 +15,8 @@
   ~ limitations under the License.
   -->
 
-<ddl-generator-assertions>
-    <ddl-generator-assertion id="t_order">
+<create-table-generator-assertions>
+    <create-table-generator-assertion id="t_order">
         <input table="t_order">
             <sql>
                 CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
@@ -59,9 +59,9 @@
                 TABLESPACE pg_default
             </sql>
         </output>
-    </ddl-generator-assertion>
+    </create-table-generator-assertion>
 
-    <ddl-generator-assertion id="t_order_item">
+    <create-table-generator-assertion id="t_order_item">
         <input table="t_order_item">
             <sql>
                 CREATE TABLE t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
@@ -112,5 +112,5 @@
                 TABLESPACE pg_default
             </sql>
         </output>
-    </ddl-generator-assertion>
-</ddl-generator-assertions>
+    </create-table-generator-assertion>
+</create-table-generator-assertions>