[
https://issues.apache.org/jira/browse/FLINK-34536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822357#comment-17822357
]
Benchao Li commented on FLINK-34536:
------------------------------------
It sounds like a useful feature from the user perspective.
Usually a numeric representation is a unixtime, and it would much like
{{cast(numeric as timstamp[_ltz])}}, which has been discussed in
[FLIP-162|https://cwiki.apache.org/confluence/display/FLINK/FLIP-162%3A+Consistent+Flink+SQL+time+function+behavior#FLIP162:ConsistentFlinkSQLtimefunctionbehavior-2.DisableCASTbetweenNUMERICandTIMESTAMP].
Hence it should be {{TIMSTAMP_LTZ}} instead of {{TIMESTAMP}} that is allowed
to be converted from numeric.
Besides, the precision of unixtime has multiple choices,
second/millisecond/microsecond, so how would you suppose to distinguish them
when converting it to {{TIMSTAMP_LTZ}}.
For now, users can deal with the conversion in SQL expression via
{{to_timestamp_ltz}} as an alternative, so I don't have a strong opinion
whether to introduce a feature in format level.
Anyway, I think this deserves a FLIP since JSON format is a very fundamental
format and this would be a public API change.
> Support reading long value as Timestamp column in JSON format
> -------------------------------------------------------------
>
> Key: FLINK-34536
> URL: https://issues.apache.org/jira/browse/FLINK-34536
> Project: Flink
> Issue Type: Improvement
> Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
> Affects Versions: 1.19.0
> Reporter: yisha zhou
> Priority: Major
>
> In many scenarios, timestamp data is stored as Long value and expected to be
> operated as Timestamp value. It's not user-friendly to use an UDF to convert
> the data before operating it.
> Meanwhile, in Avro format, it seems it can receive several types of input and
> convert it into TimestampData. Hope the same ability can be introduced into
> JSON format.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)