lsyldliu commented on code in PR #19193:
URL: https://github.com/apache/flink/pull/19193#discussion_r906753373


##########
flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserImplTest.java:
##########
@@ -313,6 +313,175 @@ void testAlterTable() {
         sql(sql3).ok(expected3);
     }
 
+    @Test
+    void testAlterTableAdd() {
+        // add single column
+        sql("alter table t1 add new_column string comment 'new_column docs'")
+                .ok("ALTER TABLE `T1` ADD `NEW_COLUMN` STRING COMMENT 
'new_column docs'");
+        sql("alter table t1 add new_column string comment 'new_column docs' 
first")
+                .ok("ALTER TABLE `T1` ADD `NEW_COLUMN` STRING COMMENT 
'new_column docs' FIRST");
+        sql("alter table t1 add new_column string comment 'new_column docs' 
after id")
+                .ok(
+                        "ALTER TABLE `T1` ADD `NEW_COLUMN` STRING COMMENT 
'new_column docs' AFTER `ID`");
+        // add compute column
+        sql("alter table t1 add col_int as col_a - col_b after col_b")
+                .ok("ALTER TABLE `T1` ADD `COL_INT` AS (`COL_A` - `COL_B`) 
AFTER `COL_B`");
+        // add metadata column
+        sql("alter table t1 add col_int int metadata from 'mk1' virtual 
comment 'comment_metadata' after col_b")
+                .ok(
+                        "ALTER TABLE `T1` ADD `COL_INT` INTEGER METADATA FROM 
'mk1' VIRTUAL "
+                                + "COMMENT 'comment_metadata' AFTER `COL_B`");
+
+        // add watermark

Review Comment:
   Currently, defining multiple watermark is not allowed in watermark parse 
phase, please see 
https://github.com/apache/flink/blob/master/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl#L714



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to