Skip to content

Commit

Permalink
add quote to ut
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba committed Jan 17, 2024
1 parent 25e9368 commit 2e415a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ public void testGenerateRenameDDLSql() {
List<String> ddlSqls =
SchemaChangeHelper.generateRenameDDLSql(
table, oldColumnName, newColumnName, originFieldSchemaMap);
Assert.assertEquals(ddlSqls.get(0), "ALTER TABLE test.test_sink RENAME COLUMN c3 c33");
Assert.assertEquals(
ddlSqls.get(0), "ALTER TABLE `test`.`test_sink` RENAME COLUMN `c3` `c33`");
}

@Test
public void testGenerateDDLSql() {
SchemaChangeHelper.compareSchema(updateFieldSchemaMap, originFieldSchemaMap);
List<String> ddlSqls = SchemaChangeHelper.generateDDLSql("test.test_sink");
Assert.assertEquals(ddlSqls.get(0), "ALTER TABLE test.test_sink ADD COLUMN c4 BIGINT");
Assert.assertEquals(
ddlSqls.get(1), "ALTER TABLE test.test_sink ADD COLUMN c5 DATETIMEV2(0)");
ddlSqls.get(0), "ALTER TABLE `test`.`test_sink` ADD COLUMN `c4` BIGINT");
Assert.assertEquals(
ddlSqls.get(1), "ALTER TABLE `test`.`test_sink` ADD COLUMN `c5` DATETIMEV2(0)");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public void setUp() {

@Test
public void testExtractDDLListMultipleColumns() throws IOException {
String sql0 = "ALTER TABLE test.t1 ADD COLUMN id INT DEFAULT '10000'";
String sql1 = "ALTER TABLE test.t1 ADD COLUMN c199 INT";
String sql2 = "ALTER TABLE test.t1 ADD COLUMN c12 INT DEFAULT '100'";
String sql3 = "ALTER TABLE test.t1 DROP COLUMN c13";
String sql0 = "ALTER TABLE `test`.`t1` ADD COLUMN `id` INT DEFAULT '10000'";
String sql1 = "ALTER TABLE `test`.`t1` ADD COLUMN `c199` INT";
String sql2 = "ALTER TABLE `test`.`t1` ADD COLUMN `c12` INT DEFAULT '100'";
String sql3 = "ALTER TABLE `test`.`t1` DROP COLUMN `c13`";
List<String> srcSqlList = Arrays.asList(sql0, sql1, sql2, sql3);

Map<String, FieldSchema> originFiledSchemaMap = new LinkedHashMap<>();
Expand Down Expand Up @@ -211,7 +211,7 @@ public void testExtractDDLListRename() throws IOException {
schemaChange.setOriginFieldSchemaMap(originFieldSchemaMap);

List<String> ddlList = schemaChange.extractDDLList(record);
Assert.assertEquals("ALTER TABLE test.t1 RENAME COLUMN c3 c333", ddlList.get(0));
Assert.assertEquals("ALTER TABLE `test`.`t1` RENAME COLUMN `c3` `c333`", ddlList.get(0));
}

@Test
Expand Down

0 comments on commit 2e415a6

Please sign in to comment.