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

xiaodao updated FLINK-24976:
----------------------------
    Description: 
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.

 

  was:
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;

in will cause mistake when the field is too much.

 


> 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