[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Weijie Guo updated FLINK-21634: --- Fix Version/s: 2.0.0 (was: 1.20.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 2.0.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] lincoln lee updated FLINK-21634: Fix Version/s: 1.20.0 (was: 1.19.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.20.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jing Ge updated FLINK-21634: Fix Version/s: 1.19.0 (was: 1.18.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.19.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xintong Song updated FLINK-21634: - Fix Version/s: 1.18.0 (was: 1.17.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.18.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xingbo Huang updated FLINK-21634: - Fix Version/s: 1.17.0 (was: 1.16.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.17.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Yun Gao updated FLINK-21634: Fix Version/s: 1.16.0 (was: 1.15.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.16.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through > {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. > [1]: > [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] > [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] > [3]: [https://trino.io/docs/current/sql/alter-table.html] > [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] > [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] dalongliu updated FLINK-21634: -- Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder columns ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- drop an old column ALTER TABLE prod.db.sample DROP measurement; -- drop columns ALTER TABLE prod.db.sample DROP (col1, col2, col3); -- drop a watermark ALTER TABLE prod.db.sample DROP WATERMARK; -- rename column name ALTER TABLE prod.db.sample RENAME `data` TO payload; -- rename table name ALTER TABLE mytable RENAME TO mytable2; -- set options ALTER TABLE kafka_table SET ( 'scan.startup.mode' = 'specific-offsets', 'scan.startup.specific-offsets' = 'partition:0,offset:42' ); -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. [1]: [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] [3]: [https://trino.io/docs/current/sql/alter-table.html] [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] dalongliu updated FLINK-21634: -- Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE mytable {code} {color:#910091} MODIFY{color} {code:sql} ( log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder columns ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- drop an old column ALTER TABLE prod.db.sample DROP measurement; -- drop columns ALTER TABLE prod.db.sample DROP (col1, col2, col3); -- drop a watermark ALTER TABLE prod.db.sample DROP WATERMARK; -- rename column name ALTER TABLE prod.db.sample RENAME `data` TO payload; -- rename table name ALTER TABLE mytable RENAME TO mytable2; -- set options ALTER TABLE kafka_table SET ( 'scan.startup.mode' = 'specific-offsets', 'scan.startup.specific-offsets' = 'partition:0,offset:42' ); -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. [1]: [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] [3]: [https://trino.io/docs/current/sql/alter-table.html] [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{RENAME TO}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] dalongliu updated FLINK-21634: -- Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE mytable {code} {color:#910091} modiy{color} {code:sql} ( log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder columns ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- drop an old column ALTER TABLE prod.db.sample DROP measurement; -- drop columns ALTER TABLE prod.db.sample DROP (col1, col2, col3); -- drop a watermark ALTER TABLE prod.db.sample DROP WATERMARK; -- rename column name ALTER TABLE prod.db.sample RENAME `data` TO payload; -- rename table name ALTER TABLE mytable RENAME TO mytable2; -- set options ALTER TABLE kafka_table SET ( 'scan.startup.mode' = 'specific-offsets', 'scan.startup.specific-offsets' = 'partition:0,offset:42' ); -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{{}Catalog#alterTable(tablePath, newTable, ignoreIfNotExists){}}}. [1]: [https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table] [2]: [http://iceberg.apache.org/spark-ddl/#alter-table-alter-column] [3]: [https://trino.io/docs/current/sql/alter-table.html] [4]: [https://dev.mysql.com/doc/refman/8.0/en/alter-table.html] [5]: [https://www.postgresql.org/docs/9.1/sql-altertable.html] was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{{}RENAME TO{}}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xintong Song updated FLINK-21634: - Fix Version/s: (was: 1.14.0) 1.15.0 > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.15.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Flink Jira Bot updated FLINK-21634: --- Labels: auto-unassigned stale-assigned (was: auto-unassigned) I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help the community manage its development. I see this issue is assigned but has not received an update in 30 days, so it has been labeled "stale-assigned". If you are still working on the issue, please remove the label and add a comment updating the community on your progress. If this issue is waiting on feedback, please consider this a reminder to the committer/reviewer. Flink is a very active project, and so we appreciate your patience. If you are no longer working on the issue, please unassign yourself so someone else may work on it. > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jark Wu >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.14.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Flink Jira Bot updated FLINK-21634: --- Labels: auto-unassigned stale-assigned (was: auto-unassigned) I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help the community manage its development. I see this issue is assigned but has not received an update in 14, so it has been labeled "stale-assigned". If you are still working on the issue, please remove the label and add a comment updating the community on your progress. If this issue is waiting on feedback, please consider this a reminder to the committer/reviewer. Flink is a very active project, and so we appreciate your patience. If you are no longer working on the issue, please unassign yourself so someone else may work on it. If the "warning_label" label is not removed in 7 days, the issue will be automatically unassigned. > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jane Chan >Priority: Major > Labels: auto-unassigned, stale-assigned > Fix For: 1.14.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Flink Jira Bot updated FLINK-21634: --- Labels: auto-unassigned (was: stale-assigned) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jane Chan >Priority: Major > Labels: auto-unassigned > Fix For: 1.14.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Flink Jira Bot updated FLINK-21634: --- Labels: stale-assigned (was: ) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jane Chan >Priority: Major > Labels: stale-assigned > Fix For: 1.14.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Fix Version/s: 1.14.0 > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jane Chan >Priority: Major > Fix For: 1.14.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Fix Version/s: (was: 1.13.0) > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Assignee: Jane Chan >Priority: Major > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Fix Version/s: 1.13.0 > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Priority: Major > Fix For: 1.13.0 > > > We already introduced ALTER TABLE statement in FLIP-69 [1], but only support > to rename table name and change table options. One useful feature of ALTER > TABLE statement is modifying schema. This is also heavily required by > integration with data lakes (e.g. iceberg). > Therefore, I propose to support following ALTER TABLE statements (except > {{SET}} and {{RENAME TO}}, others are all new introduced syntax): > {code:sql} > ALTER TABLE table_name { > ADD { | ( [, ...]) } > | MODIFY { | ( [, ...]) } > | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | > CONSTRAINT constraint_name | WATERMARK} > | RENAME old_column_name TO new_column_name > | RENAME TO new_table_name > | SET (key1=val1, ...) > | RESET (key1, ...) > } > :: > { | | } > :: > column_name [FIRST | AFTER column_name] > :: > [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED > :: > WATERMARK FOR rowtime_column_name AS watermark_strategy_expression > :: > { | | > } [COMMENT column_comment] > :: > column_type > :: > column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] > :: > AS computed_column_expression > {code} > And some examples: > {code:sql} > -- add a new column > ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; > -- add columns, constraint, and watermark > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' FIRST, > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- modify a column type > ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes > per second' AFTER `id`; > -- modify definition of column log_ts and ts, primary key, watermark. they > must exist in table schema > ALTER TABLE mytable ADD ( > log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder > columns > ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, > PRIMARY KEY (id) NOT ENFORCED, > WATERMARK FOR ts AS ts - INTERVAL '3' SECOND > ); > -- drop an old column > ALTER TABLE prod.db.sample DROP measurement; > -- drop columns > ALTER TABLE prod.db.sample DROP (col1, col2, col3); > -- drop a watermark > ALTER TABLE prod.db.sample DROP WATERMARK; > -- rename column name > ALTER TABLE prod.db.sample RENAME `data` TO payload; > -- rename table name > ALTER TABLE mytable RENAME TO mytable2; > -- set options > ALTER TABLE kafka_table SET ( > 'scan.startup.mode' = 'specific-offsets', > 'scan.startup.specific-offsets' = 'partition:0,offset:42' > ); > -- reset options > ALTER TABLE kafka_table RESET ('scan.startup.mode', > 'scan.startup.specific-offsets'); > {code} > Note: we don't need to introduce new interfaces, because all the alter table > operation will be forward to catalog through {{Catalog#alterTable(tablePath, > newTable, ignoreIfNotExists)}}. > [1]: > https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table > [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column > [3]: https://trino.io/docs/current/sql/alter-table.html > [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html > [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements (except {{SET}} and {{RENAME TO}}, others are all new introduced syntax): {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder columns ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- drop an old column ALTER TABLE prod.db.sample DROP measurement; -- drop columns ALTER TABLE prod.db.sample DROP (col1, col2, col3); -- drop a watermark ALTER TABLE prod.db.sample DROP WATERMARK; -- rename column name ALTER TABLE prod.db.sample RENAME `data` TO payload; -- rename table name ALTER TABLE mytable RENAME TO mytable2; -- set options ALTER TABLE kafka_table SET ( 'scan.startup.mode' = 'specific-offsets', 'scan.startup.specific-offsets' = 'partition:0,offset:42' ); -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: {code:sql} ALTER TABLE table_name { ADD { | ( [, ...]) } | MODIFY { | ( [, ...]) } | DROP {column_name | (column_name, column_name, ) | PRIMARY KEY | CONSTRAINT constraint_name | WATERMARK} | RENAME old_column_name TO new_column_name | RENAME TO new_table_name | SET (key1=val1, ...) | RESET (key1, ...) } :: { | | } :: column_name [FIRST | AFTER column_name] :: [CONSTRAINT constraint_name] PRIMARY KEY (column_name, ...) NOT ENFORCED :: WATERMARK FOR rowtime_column_name AS watermark_strategy_expression :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} And some examples: {code:sql} -- add a new column ALTER TABLE mytable ADD new_column STRING COMMENT 'new_column docs'; -- add columns, constraint, and watermark ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' FIRST, ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- modify a column type ALTER TABLE prod.db.sample MODIFY measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- modify definition of column log_ts and ts, primary key, watermark. they must exist in table schema ALTER TABLE mytable ADD ( log_ts STRING COMMENT 'log timestamp string' AFTER `id`, -- reoder columns ts AS TO_TIMESTAMP(log_ts) AFTER log_ts, PRIMARY KEY (id) NOT ENFORCED, WATERMARK FOR ts AS ts - INTERVAL '3' SECOND ); -- drop an old column ALTER TABLE prod.db.sample DROP measurement; -- drop columns ALTER TABLE prod.db.sample DROP (col1, col2, col3); -- drop a watermark ALTER TABLE prod.db.sample DROP WATERMARK; -- rename column name ALTER TABLE prod.db.sample RENAME `data` TO payload; -- rename table name ALTER TABLE mytable RENAME TO mytable2; -- set options ALTER TABLE kafka_table SET ( 'scan.startup.mode' = 'specific-offsets', 'scan.startup.specific-offsets' = 'partition:0,offset:42' ); -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE RENAME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard,
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Walther updated FLINK-21634: - Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE RENAME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN `data` TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- reset options ALTER TABLE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE RENAME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Walther updated FLINK-21634: - Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE RENAME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN `data` TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE table_name ADD COLUMN column_name [FIRST | AFTER column_name] :: { | | } [COMMENT column_comment] :: column_type :: column_type METADATA [ FROM metadata_key ] [ VIRTUAL ] :: AS computed_column_expression {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Add Columns* In order to support adding multiple columns easily, we will introduce {{ADD COLUMNS}}: {code:sql} ALTER TABLE table_name ADD COLUMNS (column_name [, ...]) [FIRST | AFTER column_name] {code} *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Modify Column* {code:sql} ALTER TABLE table_name MODIFY COLUMN column_name [FIRST | AFTER column_name] {code} This is not in SQL standard 2011 Section 11.10, but is in MySQL and Oracle. Modify Column can change column into arbitrary definition which works better with Flink. So we don't introduce {{ALTER COLUMN}} syntax that is not even able to change every aspect of the column. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN `data` TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement double COMMENT 'unit is bytes per second' AFTER `id`; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN `data` TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN `data` TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]:
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1, key2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]:
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/alter/#alter-table [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]:
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}}. [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}} only new synax needs to be introduced, [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]:
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} Note: we don't need to introduce new interfaces, because all the alter table operation will be forward to catalog through {{Catalog#alterTable(tablePath, newTable, ignoreIfNotExists)}} only new synax needs to be introduced, [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html > ALTER TABLE statement enhancement >
[jira] [Updated] (FLINK-21634) ALTER TABLE statement enhancement
[ https://issues.apache.org/jira/browse/FLINK-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jark Wu updated FLINK-21634: Description: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Reset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; -- reset options ALTER TALBE kafka_table RESET ('scan.startup.mode', 'scan.startup.specific-offsets'); {code} [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html was: We already introduced ALTER TABLE statement in FLIP-69 [1], but only support to rename table name and change table options. One useful feature of ALTER TABLE statement is modifying schema. This is also heavily required by integration with data lakes (e.g. iceberg). Therefore, I propose to support following ALTER TABLE statements: *Add Column* {code:sql} ALTER TABLE ADD COLUMN [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Drop Column* {code:sql} ALTER TABLE DROP COLUMN {code} This follows SQL standard 2011 Section 11.10. And Iceberg[2], Trino[3], MySQL[4] also are the same. *Alter Column* {code:sql} ALTER TABLE ALTER COLUMN SET DATA TYPE [COMMENT column_comment] {code} This follows SQL standard 2011 Section 11.10. Same to PG [5], and similar to Iceberg[2], Trino[3], MySQL[4]. *Rename Column* {code:sql} ALTER TABLE REANME COLUMN TO {code} This is not listed in SQL standard, but is also very useful. Follows the syntax of Iceberg[2], Trino[3], MySQL[4]. *Unset Options* {code:sql} ALTER TABLE RESET (key1=val1, key2=val2, ...) {code} Out of SQL standard, but is useful. Has been discussed in FLINK-17845. Use {{RESET}} to keep align with {{SET key=value}} and {{RESET key}} proposed in FLIP-163. And PG[5] also uses the {{RESET}} keyword. For example: {code:sql} -- add a new column ALTER TABLE mytable ADD COLUMN new_column STRING COMMENT 'new_column docs'; -- drop an old column ALTER TABLE prod.db.sample DROP COLUMN legacy_name; -- rename column name ALTER TABLE prod.db.sample RENAME COLUMN data TO payload; -- alter table type ALTER TABLE prod.db.sample ALTER COLUMN measurement SET DATA TYPE double COMMENT 'unit is bytes per second'; {code} [1]: https://cwiki.apache.org/confluence/display/FLINK/FLIP+69+-+Flink+SQL+DDL+Enhancement [2]: http://iceberg.apache.org/spark-ddl/#alter-table-alter-column [3]: https://trino.io/docs/current/sql/alter-table.html [4]: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html [5]: https://www.postgresql.org/docs/9.1/sql-altertable.html > ALTER TABLE statement enhancement > - > > Key: FLINK-21634 > URL: https://issues.apache.org/jira/browse/FLINK-21634 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API, Table SQL / Client >Reporter: Jark Wu >Priority: Major > > We already