You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Bo Cui (Jira)" <ji...@apache.org> on 2023/04/24 03:03:00 UTC

[jira] [Commented] (FLINK-21714) Use TIMESTAMP_LTZ as return type for function PROCTIME()

    [ https://issues.apache.org/jira/browse/FLINK-21714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17715562#comment-17715562 ] 

Bo Cui commented on FLINK-21714:
--------------------------------

[~leonard] hi
Have you tested the sql?
val table = tEnv.sqlQuery(
      """
        |SELECT CURRENT_TIMESTAMP, proctime()
        |""".stripMargin
    )
 val result = tEnv.toDataStream(table, DataTypes.ROW(DataTypes.TIMESTAMP_LTZ(), DataTypes.TIMESTAMP_LTZ()))
 result.print()

and test

val sink = new TestingAppendSink
table.toAppendStream[Row].addSink(sink)

> Use TIMESTAMP_LTZ as return type for function PROCTIME()
> --------------------------------------------------------
>
>                 Key: FLINK-21714
>                 URL: https://issues.apache.org/jira/browse/FLINK-21714
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Leonard Xu
>            Assignee: Leonard Xu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.13.0
>
>
> When users use a PROCTIME() in SQL, the return value of PROCTIME() has a timezone offset with the wall-clock time in users' local time zone, users need to add their local time zone offset manually to get expected local timestamp(e.g: Users in Germany need to +1h to get expected local timestamp). 
> This issue to correct PROCTIME()  function
> |*function*|*existed problem*|*current behavior*|*proposed changes*|
> |PROCTIME()|returns UTC timestamp, but user expects current timestamp in session time zone|return type: TIMESTAMP  *PROCTIME*
> #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 for PROCTIME(), the return type should be *TIMESTAMP  WITH LOCAL TIME ZONE *PROCTIME**
> #session timezone: UTC
> 2020-12-28 23:52:52
> #session timezone: UTC+8
> 2020-12-29 07:52:52|



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