You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "JasonLee (Jira)" <ji...@apache.org> on 2022/07/22 15:20:00 UTC

[jira] [Commented] (FLINK-28650) Flink SQL Parsing bug for METADATA

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

JasonLee commented on FLINK-28650:
----------------------------------

hi [~qinjunjerry] ,maybe u can try the following
{code:java}
// code placeholder
INSERT INTO sinkTable1
SELECT 
`time`, 
`value`
FROM sourceTable; {code}

> Flink SQL Parsing bug for METADATA
> ----------------------------------
>
>                 Key: FLINK-28650
>                 URL: https://issues.apache.org/jira/browse/FLINK-28650
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.14.4
>            Reporter: Jun Qin
>            Priority: Major
>
> With the following source/sink tables:
> {code:sql}
> CREATE TABLE sourceTable ( 
> `key` INT, 
> `time` TIMESTAMP(3),
> `value` STRING NOT NULL, 
> id INT 
> ) 
> WITH ( 
> 'connector' = 'datagen', 
> 'rows-per-second'='10', 
> 'fields.id.kind'='sequence', 
> 'fields.id.start'='1', 
> 'fields.id.end'='100' 
> );
> CREATE TABLE sinkTable1 ( 
> `time` TIMESTAMP(3) METADATA FROM 'timestamp', 
> `value` STRING NOT NULL
> ) 
> WITH ( 
>   'connector' = 'kafka',
> ...
> )
> CREATE TABLE sinkTable2 ( 
> `time` TIMESTAMP(3),    -- without METADATA
> `value` STRING NOT NULL
> ) 
> WITH ( 
>   'connector' = 'kafka',
> ...
> )
> {code}
> the following three pass the validation:
> {code:sql}
> INSERT INTO sinkTable1
> SELECT 
> `time`, 
> `value`
> FROM sourceTable;
> INSERT INTO sinkTable2
> SELECT 
> `time`, 
> `value`
> FROM sourceTable;
> INSERT INTO sinkTable2 (`time`,`value`)
> SELECT 
> `time`, 
> `value`
> FROM sourceTable;
> {code}
> but this one does not:
> {code:sql}
> INSERT INTO sinkTable1 (`time`,`value`)
> SELECT 
> `time`, 
> `value`
> FROM sourceTable;
> {code}
> It failed with 
> {code:java}
> Unknown target column 'time'
> {code}
> It seems when providing column names in INSERT, the METADATA have an undesired effect. 



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