Timo Theusner created FLINK-41520:
-------------------------------------
Summary: Reject partition key changes in CREATE OR ALTER
MATERIALIZED TABLE
Key: FLINK-41520
URL: https://issues.apache.org/jira/browse/FLINK-41520
Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: Timo Theusner
When {{CREATE OR ALTER MATERIALIZED TABLE}} alters an existing materialized
table, {{MaterializedTableOperationFactory#handleAlter}} emits no
{{TableChange}} for partition keys, but {{buildNewTable}} takes them from the
statement's {{{}PARTITIONED BY{}}}. Catalogs that store the new table, such as
{{{}GenericInMemoryCatalog{}}}, therefore drop or replace the keys without an
error when the clause is omitted or different. The existing data then no longer
matches the table's layout. The alter path should fail, as conversion does
since FLINK-41468.
Proposed Changes
* Move the partition-key check out of
{{MaterializedTableOperationFactory#handleConvert}} into a helper whose message
fits both conversion and alter
* Call the helper in {{{}handleAlter{}}}, so a partitioned materialized table
fails with a {{ValidationException}} unless {{PARTITIONED BY}} lists its keys
in the same order
* Keep letting an unpartitioned materialized table take the statement's keys,
as conversion does
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)