Qilong Wang created FLINK-41637:
-----------------------------------

             Summary: UNIX_TIMESTAMP with string arguments is treated as 
non-deterministic
                 Key: FLINK-41637
                 URL: https://issues.apache.org/jira/browse/FLINK-41637
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 2.3.0
            Reporter: Qilong Wang


An updating table events(id INT, ts STRING) emits inserts, update-before, 
update-after and deletes. The sink sink_t(id INT) accepts retractions and has 
no primary key.

{code:sql}
SET 'table.optimizer.non-deterministic-update.strategy' = 'TRY_RESOLVE';
EXPLAIN PLAN FOR INSERT INTO sink_t
SELECT id FROM events
WHERE UNIX_TIMESTAMP(ts, 'yyyy-MM-dd HH:mm:ss') > 0;
{code}

Planning fails with {{There exists non deterministic function: 'UNIX_TIMESTAMP' 
in condition}}. The same happens with {{UNIX_TIMESTAMP(ts)}}. Both calls parse 
their arguments and should be accepted when the operands are deterministic. The 
zero-argument {{UNIX_TIMESTAMP()}} reads the clock and should continue to be 
treated as non-deterministic.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to