简体   繁体   English

如何在 Flink SQL Client 中切换到时间戳解析

[英]how to switch to timestamp parse in Flink SQL Client

I want my Flink SQL Client to read data from Kafka我希望我的Flink SQL Client从 Kafka 读取数据
and the data produced by kafka is Timestamp style,而kafka产生的数据是Timestamp风格的,
but the default Flink SQL Client Parse is DateTime style,但默认的 Flink SQL Client Parse 是DateTime样式,

How to force Flink SQL to switch to Timestamp style?如何强制 Flink SQL 切换到Timestamp样式?

Thanks for your help~!谢谢你的帮助~!

在此处输入图像描述

my.yaml file is here my.yaml 文件在这里

I think, the transformation are looking for is TO_TIMESTAMP(FROM_UNIXTIME(<your column>) eg like this我认为,正在寻找的转换是TO_TIMESTAMP(FROM_UNIXTIME(<your column>)例如像这样

CREATE TABLE your table (
  unix_ts STRING, --your original column
  ts AS TO_TIMESTAMP(FROM_UNIXTIME(unix_ts))
) WITH (
  ...
)

Some more examples for time/data handling can be found eg in https://github.com/ververica/flink-sql-cookbook/blob/master/recipes/12/12_date_time.md .可以在https://github.com/ververica/flink-sql-cookbook/blob/master/recipes/12/12_date_time.md中找到更多时间/数据处理的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM