[ https://issues.apache.org/jira/browse/FLINK-21713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
lincoln lee updated FLINK-21713: -------------------------------- Summary: Correct function CURRENT_TIMESTAMP/CURRENT_TIME/CURRENT_DATE/NOW/LOCALTIME/LOCALTIMESTAMP (was: Fix the determinism declaration of the rand function to be consistent with the current behavior) > Correct function > CURRENT_TIMESTAMP/CURRENT_TIME/CURRENT_DATE/NOW/LOCALTIME/LOCALTIMESTAMP > ----------------------------------------------------------------------------------------- > > Key: FLINK-21713 > URL: https://issues.apache.org/jira/browse/FLINK-21713 > Project: Flink > Issue Type: Sub-task > Components: Table SQL / API > Environment: The value of time function CURRENT_TIMESTAMP and NOW() > are corrected from UTC time with `TIMESTAMP` type to epoch time with > `TIMESTAMP_LTZ` type. Time function LOCALTIME, LOCALTIMESTAMP, CURRENT_DATE, > CURRENT_TIME, CURRENT_TIMESTAMP and NOW() are corrected from evaluates for > per record in batch mode to evaluate once at query-start for batch job. > Reporter: Leonard Xu > Assignee: Leonard Xu > Priority: Major > Labels: pull-request-available > Fix For: 1.13.0 > > > 1. fix the return value type as well the return value for following time > functions > > |*function*|*existed problem*|*current behavior*|*proposed changes*| > |CURRENT_DATE|returns UTC date, but user expects current date in session time > zone|return type: DATE > #session timezone: UTC > 2020-12-28 > #session timezone: UTC+8 > 2020-12-28| return current date in session time zone, the return type should > be *DATE* > #session timezone: UTC > 2020-12-28 > #session timezone: UTC+8 > 2020-12-29| > |CURRENT_TIME|returns UTC time, but user expects current time in session time > zone|return type: TIME > #session timezone: UTC > 23:52:52 > #session timezone: UTC+8 > 23:52:52|return current time in session time zone, the return type should be > *TIME* > #session timezone: UTC > 23:52:52 > #session timezone: UTC+8 > 07:52:52| > |CURRENT_TIMESTAMP|returns UTC timestamp, but user expects current timestamp > in session time zone| > return type: TIMESTAMP > #session timezone: UTC > 2020-12-28 23:52:52 > #session timezone: UTC+8 > 2020-12-28 23:52:52|return current timestamp in session time zone, the return > type should be > *TIMESTAMP WITH LOCAL TIME ZONE* > #session timezone: UTC > 2020-12-28 23:52:52 > #session timezone: UTC+8 > 2020-12-29 07:52:52| > |NOW()|returns UTC timestamp, but user expects current timestamp in session > time zone| > return type: TIMESTAMP > #session timezone: UTC > 2020-12-28 23:52:52 > #session timezone: UTC+8 > 2020-12-28 23:52:52|return current timestamp in session time zone, the return > type should be > *TIMESTAMP WITH LOCAL TIME ZONE* > #session timezone: UTC > 2020-12-28 23:52:52 > #session timezone: UTC+8 > 2020-12-29 07:52:52| > > 2. The following functions' evaluation is depend on execution mode > * LOCALTIME > * LOCALTIMESTAMP > * CURRENT_DATE > * CURRENT_TIME > * CURRENT_TIMESTAMP > * NOW() > Flink evaluates above time function values according to execution mode, i.e. > Flink evaluates time function value for row level in Streaming mode, > evaluates the time function value at query start for batch mode. -- This message was sent by Atlassian Jira (v8.20.10#820010)