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

Leonard Xu reassigned FLINK-36861:
----------------------------------

    Assignee: Sergio Peña

> CREATE TABLE AS with METADATA columns doesn't work
> --------------------------------------------------
>
>                 Key: FLINK-36861
>                 URL: https://issues.apache.org/jira/browse/FLINK-36861
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Sergio Peña
>            Assignee: Sergio Peña
>            Priority: Major
>              Labels: pull-request-available
>
> When creating a table with CTAS with a metadata column in the CREATE part, if 
> the source query already declares that, then the CTAS fails that it cannot 
> override the metadata column:
>  
> {{CREATE TABLE payments (}}
> {{  payment_id STRING PRIMARY KEY NOT ENFORCED,}}
> {{  payment_time TIMESTAMP(3) METADATA FROM 'timestamp'}}
> {{) DISTRIBUTED BY HASH(payment_id) INTO 4 BUCKETS}}
> {{WITH ('connector' = 'kafka')}}
> {{AS SELECT payment_id, payment_time FROM source;}}
>  
> The error is:
> {{A column named 'payment_time' already exists in the source schema. Computed 
> and metadata columns cannot overwrite regular columns.}}
>  
> We should allow CTAS to write source columns to metadata columns (if metadata 
> cols are not virtual). Only computed and virtual metadata columns should be 
> read-only and not allowed in the query-to-sink.



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

Reply via email to