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

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

Jun Qin created FLINK-28650:
-------------------------------

             Summary: 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


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)