You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "谢波 (Jira)" <ji...@apache.org> on 2023/02/08 13:21:00 UTC

[jira] [Created] (FLINK-30966) Flink SQL IF FUNCTION logic error

谢波 created FLINK-30966:
--------------------------

             Summary: Flink SQL IF FUNCTION logic error
                 Key: FLINK-30966
                 URL: https://issues.apache.org/jira/browse/FLINK-30966
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.16.1, 1.16.0
            Reporter: 谢波


my data is 
{code:java}
//
{ "before": { "status": "sent" }, "after": { "status": "succeed" }, "op": "u", "ts_ms": 1671926400225, "transaction": null } {code}
my sql is 

 
{code:java}
CREATE TABLE t
(
    before ROW (

        status varchar (32)

        ),
    after ROW (

        status varchar (32)

        ),
    ts_ms                bigint,
    op                   string,
    kafka_timestamp      timestamp METADATA FROM 'timestamp',
--     @formatter:off
    proctime AS PROCTIME()
--     @formatter:on
) WITH (
    'connector' = 'kafka',
--     'topic' = '',
    'topic' = 'test',
    'properties.bootstrap.servers' = ' ',
    'properties.group.id' = '',
    'format' = 'json',
    'scan.topic-partition-discovery.interval' = '60s',
    'scan.startup.mode' = 'earliest-offset',
    'json.ignore-parse-errors' = 'true'
 );
create table p
(
    status                  STRING ,
    before_status                  STRING ,
    after_status                  STRING ,
    metadata_operation      STRING COMMENT '源记录操作类型',
    dt                      STRING
)WITH (
    'connector' = 'print'
 );
INSERT INTO p
SELECT
       IF(op <> 'd', after.status, before.status),
        before.status,
        after.status,
       op                                         AS metadata_operation,
       DATE_FORMAT(kafka_timestamp, 'yyyy-MM-dd') AS dt
FROM t;

 {code}
 my local env output is 

 

 
{code:java}
+I[null, BroadcastedSent, Succeed, u, 2023-02-08] {code}
 

 my produtionc env output is 
{code:java}
+I[BroadcastedSent, BroadcastedSent, Succeed, u, 2023-02-08]  {code}
why?  
This look like a bug.

 



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