You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/22 03:11:28 UTC

[GitHub] [shardingsphere] azexcy commented on a diff in pull request #19456: Clean unused code in AbstractDataSourcePreparer and fix ci

azexcy commented on code in PR #19456:
URL: https://github.com/apache/shardingsphere/pull/19456#discussion_r927252343


##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparerTest.java:
##########
@@ -39,36 +38,18 @@ public void prepareTargetTables(final PrepareTargetTablesParameter parameter) {
         }
     };
     
-    @Test
-    public void assertGetTableDefinitionSQLType() {
-        assertThat(preparer.getTableDefinitionSQLType("SET search_path = public"), is(TableDefinitionSQLType.UNKNOWN));
-        assertThat(preparer.getTableDefinitionSQLType("CREATE TABLE t1_0 (id int NOT NULL)"), is(TableDefinitionSQLType.CREATE_TABLE));
-        assertThat(preparer.getTableDefinitionSQLType("ALTER TABLE t1_0 ADD CONSTRAINT t1_0_pkey PRIMARY KEY (id)"), is(TableDefinitionSQLType.ALTER_TABLE));
-    }
-    
     @Test
     public void assertAddIfNotExistsForCreateTableSQL() {
         Collection<String> createTableSQLs = Arrays.asList("CREATE TABLE IF NOT EXISTS t (id int)", "CREATE TABLE t (id int)",
-                "CREATE  TABLE IF \nNOT \tEXISTS t (id int)", "CREATE \tTABLE t (id int)");
+                "CREATE  TABLE IF \nNOT \tEXISTS t (id int)", "CREATE \tTABLE t (id int)", "CREATE TABLE \tt_order (id bigint) WITH (orientation=row, compression=no);");
         for (String each : createTableSQLs) {
-            String sql = preparer.addIfNotExistsForCreateTableSQL(each);
-            assertTrue(PATTERN_CREATE_TABLE_IF_NOT_EXISTS.matcher(sql).find());
+            String actual = preparer.addIfNotExistsForCreateTableSQL(each);
+            assertTrue(PATTERN_CREATE_TABLE_IF_NOT_EXISTS.matcher(actual).find());
+        }
+        Collection<String> mismatchedSQLs = Arrays.asList("SET search_path = public", "UPDATE t_order SET id = 1");
+        for (String each : mismatchedSQLs) {
+            String actual = preparer.addIfNotExistsForCreateTableSQL(each);
+            assertThat(actual, is(actual));
         }

Review Comment:
   This is a mistake. I will fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org