Timo Theusner created FLINK-41679:
-------------------------------------

             Summary: Make ALTER MATERIALIZED TABLE MODIFY reject physical 
column reordering 
                 Key: FLINK-41679
                 URL: https://issues.apache.org/jira/browse/FLINK-41679
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: Timo Theusner


{{ALTER MATERIALIZED TABLE t MODIFY (b STRING FIRST)}} on a physical column is 
accepted and reorders the schema but not the query, so the positional refresh 
swaps data. On metadata and computed columns, {{FIRST}}/{{AFTER}} is silently 
ignored because {{MaterializedTableChangeHandler#modifyColumn}} drops the 
position. FLIP-550 forbids changing physical columns and allows moving metadata 
and computed columns.

Proposed Changes
* Apply the position of a {{ModifyColumn}} in 
{{MaterializedTableChangeHandler#modifyColumn}}
* Reject schema-only alters that change the order of physical columns in 
{{AlterMaterializedTableChangeOperation#validateChanges}}; physical type 
changes stay as they are
* Leave {{SchemaModifyConverter}} emitting the requested position, so the 
restriction stays a validation rule
* Rewrite the stored query when a persisted metadata column moves, using the 
stored-query rewrite
* State in the MODIFY section of {{statements.md}} that physical columns cannot 
be moved



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to