You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "david radley (Jira)" <ji...@apache.org> on 2026/05/18 12:49:00 UTC

[jira] [Commented] (FLINK-39700) Fix name-based column matching in materialized table schema diff

    [ https://issues.apache.org/jira/browse/FLINK-39700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081721#comment-18081721 ] 

david radley commented on FLINK-39700:
--------------------------------------

[~arvid] Do we need to do anything special for nested columns?

> Fix name-based column matching in materialized table schema diff
> ----------------------------------------------------------------
>
>                 Key: FLINK-39700
>                 URL: https://issues.apache.org/jira/browse/FLINK-39700
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.3.0
>            Reporter: Arvid Heise
>            Assignee: Arvid Heise
>            Priority: Major
>             Fix For: 2.4.0
>
>
> MaterializedTableUtils.validateAndExtractColumnChanges currently compares schemas positionally (by index). This makes it order-sensitive: if physical DDL columns appear in a different order between the old and new schema, the diff produces spurious ModifyPhysicalColumnType changes or incorrect validation errors. Since DDL column order is arbitrary, the comparison should be name-based.
> Additionally, when a physical column has a type change and a comment change at the same time, only ModifyPhysicalColumnType is emitted. The comment change is silently dropped because the early continue skips the comment-comparison block.
> Fix:
>                                                                                                                                      
> 1. Build a Map<String, Column> from the old schema and match new columns by name, treating unmatched columns as additions or drops.
> 2. After emitting ModifyPhysicalColumnType, check whether the comment also changed before continuing. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)