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

Jark Wu closed FLINK-24976.
---------------------------
    Resolution: Not A Problem

This is a SQL standard that not valid field names when INSERT INTO. If you want 
to have a clear insert fields in the statement, you can specify the insert 
column list [1], for example: 

{code}
INSERT INTO T(c, b) SELECT x, y FROM S;
{code}

[1]: 
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/insert/

> sink utils not check the schema info between  query and sink table
> ------------------------------------------------------------------
>
>                 Key: FLINK-24976
>                 URL: https://issues.apache.org/jira/browse/FLINK-24976
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table SQL / Planner
>    Affects Versions: 1.12.5
>            Reporter: xiaodao
>            Priority: Major
>
> sql like this
> {code:java}
> //CREATE TABLE source
> (
>     id        INT,
>     name      STRING,
>     PROCTIME AS PROCTIME()
> ) WITH (
>       'connector' = 'kafka'
>       ,'topic' = 'da'
>       ,'properties.bootstrap.servers' = 'localhost:9092'
>       ,'properties.group.id' = 'test'
>       ,'scan.startup.mode' = 'earliest-offset'
>       ,'format' = 'json'
>       ,'json.timestamp-format.standard' = 'SQL'
>       ); create table MyResultTable (
>     id int,
>     name string,
>     primary key (id) not enforced
> ) with (
>     'connector' = 'jdbc',
>     'url' = 'jdbc:mysql://localhost:3306/test',
>     'table-name' = 'users',
>     'username' = 'root',
>     'password' = 'abc123'
> );     
> insert into MyResultTable select id as idx, name, age from source; {code}
> in this sql, sink table has field "id","name", but my query result is just 
> "idx", "name";
> the sql execute is ok;
> but my question why it not valid name of query and sink table ;
> the code is in 
> org.apache.flink.table.planner.sinks.DynamicSinkUtils#validateSchemaAndApplyImplicitCast
> in will cause mistake when the field is too much.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to