You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "leonardBang (via GitHub)" <gi...@apache.org> on 2023/03/17 10:08:11 UTC

[GitHub] [flink] leonardBang commented on a diff in pull request #22201: [FLINK-30959][table][doc-zh] Improve the documentation of UNIX_TIMESTAMP function for different argument formats

leonardBang commented on code in PR #22201:
URL: https://github.com/apache/flink/pull/22201#discussion_r1140032804


##########
docs/data/sql_functions_zh.yml:
##########
@@ -630,6 +630,23 @@ temporal:
     description: |
       使用表配置中指定的时区将格式为 string2 的日期时间字符串 string1(如果未指定默认情况下:yyyy-MM-dd HH:mm:ss)
       转换为 Unix 时间戳(以秒为单位)。
+      
+      如果日期时间字符串指定了时区并使用UTC+X的格式解析(例如:"yyyy-MM-dd HH:mm:ss.SSS X"),此函数将会使用日期
+      时间字符串中的时区来转换,而不是表配置的时区。
+      如果日期时间字符串无法正常解析,此函数将会默认返回Long.MIN_VALUE(即-9223372036854775808)作为结果。

Review Comment:
   ```suggestion
         如果时间戳字符串指定了时区并使用 UTC+X 的格式解析(例如:"yyyy-MM-dd HH:mm:ss.SSS X"),此函数将会使用时间戳字符串中的时区来转换,而不是 Flink 会话中所配置的时区。
         如果时间戳字符串无法正常解析,此函数将会默认返回 Long.MIN_VALUE(即: -9223372036854775808)作为结果。
   ```



##########
docs/data/sql_functions_zh.yml:
##########
@@ -630,6 +630,23 @@ temporal:
     description: |
       使用表配置中指定的时区将格式为 string2 的日期时间字符串 string1(如果未指定默认情况下:yyyy-MM-dd HH:mm:ss)
       转换为 Unix 时间戳(以秒为单位)。
+      
+      如果日期时间字符串指定了时区并使用UTC+X的格式解析(例如:"yyyy-MM-dd HH:mm:ss.SSS X"),此函数将会使用日期
+      时间字符串中的时区来转换,而不是表配置的时区。
+      如果日期时间字符串无法正常解析,此函数将会默认返回Long.MIN_VALUE(即-9223372036854775808)作为结果。
+
+      ```sql
+      Flink SQL> SET 'table.local-time-zone' = 'Europe/Berlin';
+
+      -- Returns 25201
+      Flink SQL> SELECT UNIX_TIMESTAMP('1970-01-01 08:00:01.001', 'yyyy-MM-dd HH:mm:ss.SSS');
+      -- Returns 1
+      Flink SQL> SELECT UNIX_TIMESTAMP('1970-01-01 08:00:01.001 +0800', 'yyyy-MM-dd HH:mm:ss.SSS X');
+      -- Returns 25201
+      Flink SQL> SELECT UNIX_TIMESTAMP('1970-01-01 08:00:01.001 +0800', 'yyyy-MM-dd HH:mm:ss.SSS');
+      -- Returns -9223372036854775808
+      Flink SQL> SELECT UNIX_TIMESTAMP('1970-01-01 08:00:01.001', 'yyyy-MM-dd HH:mm:ss.SSS X');

Review Comment:
   Returns -> 返回



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org