Ramin Gharib created FLINK-39302:
------------------------------------

             Summary: Handling Idempotency in SHOW CREATE [OR ALTER] for 
Relative Intervals
                 Key: FLINK-39302
                 URL: https://issues.apache.org/jira/browse/FLINK-39302
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / Planner
            Reporter: Ramin Gharib


When using relative time intervals (such as {{{}FROM_NOW(INTERVAL '7' DAY){}}}) 
for materialized table start modes, the expression is inherently non-idempotent 
because its evaluated value changes depending on when the command is run.

To ensure clarity and maintain idempotency for users auditing or recreating 
tables, the {{SHOW CREATE [OR ALTER] MATERIALIZED TABLE}} command will output 
the user's original relative expression, but append an inline SQL comment 
containing the exact timestamp that was resolved at the time of execution.



*Example:* If a user submits: {{START_MODE = FROM_NOW(INTERVAL '7' DAY)}}

The {{SHOW CREATE OR ALTER}} output will render as: {{START_MODE = 
FROM_NOW(INTERVAL '7' DAY) /* Evaluated to FROM_TIMESTAMP(TIMESTAMP '2025-10-28 
10:00:00') at execution */}}

This approach preserves the user's original intent while providing the precise, 
deterministic timestamp used by the engine.



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

Reply via email to