[
https://issues.apache.org/jira/browse/FLINK-14925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ramin Gharib reassigned FLINK-14925:
------------------------------------
Release Note: TO_TIMESTAMP(string, format) now infers its output precision
from the format, like TO_TIMESTAMP_LTZ. A literal format with 4 to 9 'S'
characters, such as 'yyyy-MM-dd HH:mm:ss.SSSSSS', now returns TIMESTAMP(p)
instead of TIMESTAMP(3) and keeps the sub-millisecond digits. The 1-argument
form, formats with up to 3 'S' and non-literal formats still return
TIMESTAMP(3). A rowtime attribute supports precision 0 to 3 only, so a
watermark on a column with a higher precision now fails. Cast it first with
CAST(TO_TIMESTAMP(s, '...') AS TIMESTAMP(3)). A literal format that is not a
valid pattern now fails at planning time instead of returning NULL.
Assignee: Ramin Gharib (was: Zhenghua Gao)
Description:
{{TO_TIMESTAMP(string, format)}} always returns {{TIMESTAMP(3)}}, so a format
such as {{'yyyy-MM-dd HH:mm:ss.SSSSSS'}} drops the digits after the third.
{{TO_TIMESTAMP}} should infer the output precision from a literal format, like
{{TO_TIMESTAMP_LTZ}} does since FLINK-39244: the longest run of 'S' outside
quoted sections, clamped to \[3, 9\].
The 1-argument form, formats with up to 3 'S' and formats that are not literals
keep {{TIMESTAMP(3)}}. A rowtime attribute still supports precision 0 to 3
only, see FLINK-15528. So a watermark needs a cast to {{TIMESTAMP(3)}} when the
format has more than 3 'S'.
Issue Type: Improvement (was: New Feature)
Summary: Infer the TO_TIMESTAMP precision from the format pattern
(was: the return type of TO_TIMESTAMP should be Timestamp(9) instead of
Timestamp(3))
> Infer the TO_TIMESTAMP precision from the format pattern
> --------------------------------------------------------
>
> Key: FLINK-14925
> URL: https://issues.apache.org/jira/browse/FLINK-14925
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Affects Versions: 1.10.0
> Reporter: Zhenghua Gao
> Assignee: Ramin Gharib
> Priority: Not a Priority
> Labels: pull-request-available, stale-assigned
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {{TO_TIMESTAMP(string, format)}} always returns {{TIMESTAMP(3)}}, so a format
> such as {{'yyyy-MM-dd HH:mm:ss.SSSSSS'}} drops the digits after the third.
> {{TO_TIMESTAMP}} should infer the output precision from a literal format,
> like {{TO_TIMESTAMP_LTZ}} does since FLINK-39244: the longest run of 'S'
> outside quoted sections, clamped to \[3, 9\].
> The 1-argument form, formats with up to 3 'S' and formats that are not
> literals keep {{TIMESTAMP(3)}}. A rowtime attribute still supports precision
> 0 to 3 only, see FLINK-15528. So a watermark needs a cast to {{TIMESTAMP(3)}}
> when the format has more than 3 'S'.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)