[ 
https://issues.apache.org/jira/browse/FLINK-41678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timo Theusner updated FLINK-41678:
----------------------------------
    Release Note: Re-running CREATE OR ALTER MATERIALIZED TABLE on a table 
created before this fix, with a names-only column list in a different order 
than the query, now stores the query in the column list's order. This modifies 
the definition query and starts a new refresh job, which corrects the swapped 
column values.

> Store a materialized table's query in the table's column order
> --------------------------------------------------------------
>
>                 Key: FLINK-41678
>                 URL: https://issues.apache.org/jira/browse/FLINK-41678
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: Timo Theusner
>            Assignee: Timo Theusner
>            Priority: Major
>              Labels: pull-request-available
>
> A names-only column list in a different order than the query, e.g. {{CREATE 
> MATERIALIZED TABLE t (b, a) AS SELECT a, b FROM src}}, stores the table as 
> {{(b, a)}} but keeps the query unchanged. The refresh INSERT is positional, 
> so {{b}} receives {{a}}'s values and vice versa. {{alignQuery}} reorders the 
> query operation, but the stored expanded query is not aligned. FLIP-550 
> requires this reorder to work as in CTAS.
> Proposed Changes
> * Rewrite the query's select list into the order of a names-only column list 
> and store its expanded text, as CTAS does
> * Apply it on CREATE, CREATE OR ALTER and conversion of a table
> * Reorder SELECT, WITH and set operations; remap ordinal ORDER BY items to 
> the moved columns
> * Reject a query that can't be reordered (e.g. VALUES) with a hint to wrap it 
> in a SELECT



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

Reply via email to