Skip to content

Commit

Permalink
default value add
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba committed Jan 24, 2024
1 parent 11e7369 commit d67d9b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static String buildAddColumnDDL(String tableIdentifier, FieldSchema field
DorisSystem.identifier(name),
type);
if (!StringUtils.isNullOrWhitespaceOnly(defaultValue)) {
addDDL = addDDL + " DEFAULT " + defaultValue;
addDDL = addDDL + " DEFAULT '" + defaultValue + "'";
}
if (!StringUtils.isNullOrWhitespaceOnly(comment)) {
addDDL = addDDL + " COMMENT '" + DorisSystem.quoteComment(comment) + "'";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public void testAddColumn() {
Assert.assertEquals(
"ALTER TABLE `test`.`test_flink` ADD COLUMN `col` int COMMENT 'comment \"\\'sdf\\''",
addColumnDDL);

field = new FieldSchema("col", "int", "10","comment \"'sdf'");
addColumnDDL = SchemaChangeHelper.buildAddColumnDDL("test.test_flink", field);
Assert.assertEquals(
"ALTER TABLE `test`.`test_flink` ADD COLUMN `col` int DEFAULT '10' COMMENT 'comment \"\\'sdf\\''",
addColumnDDL);
}

@Test
Expand Down

0 comments on commit d67d9b1

Please sign in to comment.