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

EMing Zhou commented on FLINK-28262:
------------------------------------

[~simen] ,I agree with [~Leo Zhou] 's point of view, the grammar of this piece 
can be referred to here([INSERT 
Statement|https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/dev/table/sql/insert/])
{code:java}
[EXECUTE] INSERT { INTO | OVERWRITE } [catalog_name.][db_name.]table_name 
[PARTITION part_spec] [column_list] select_statement

part_spec:
  (part_col_name1=val1 [, part_col_name2=val2, ...])

column_list:
  (col_name1 [, column_name2, ...]) {code}

> The select result does not match the sink table
> -----------------------------------------------
>
>                 Key: FLINK-28262
>                 URL: https://issues.apache.org/jira/browse/FLINK-28262
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner, Table SQL / Runtime
>    Affects Versions: 1.14.0
>            Reporter: simenliuxing
>            Priority: Major
>
> sql is as follows:
> {code:java}
> CREATE TABLE source
> (
>     int_one INT,
>     int_two INT
> ) WITH (
>       'connector' = 'datagen'
>       ,'rows-per-second' = '1'
>       ,'fields.int_one.min' = '1'
>       ,'fields.int_one.max' = '1'
>       ,'fields.int_two.min' = '2'
>       ,'fields.int_two.max' = '2'
>       );
> CREATE TABLE sink
> (
>     int_one0 INT,
>     int_two0 INT
> ) WITH (
>       'connector' = 'print'
>       );
> insert into sink
> select
>        int_two as int_two0,  -- The result I want is to write to the int_two0 
> field of the sink table
>        int_one as int_one0   -- The result I want is to write to the int_one0 
> field of the sink table
> from source;
> {code}
>  
> The result is as follows:
> {code:java}
> +I[2, 1]
> +I[2, 1]
> +I[2, 1]{code}
> expected outcome:
> {code:java}
> +I[1, 2] 
> +I[1, 2] 
> +I[1, 2]{code}
> The problem seems to be here, I want query result and result table to be 
> mapped by field name instead of location:
> {code:java}
> select
>        int_two as int_two0, 
>        int_one as int_one0 
> from source;{code}
> Will this issue be fixed in a later version?



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

Reply via email to