You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by "18500348251@163.com" <18...@163.com> on 2020/07/15 07:03:55 UTC

flink1.11 sql kafka 抽取事件时间

大家好!

使用flink1.11 sql接入kafka ,format为csv
从eventTime字段中抽取事件时间
rowtime AS TO_TIMESTAMP(FROM_UNIXTIME(eventTime / 1000, 'yyyy-MM-dd HH:mm:ss'))
eventTime可能存在脏数据(非13位的毫秒时间戳),设置了 'csv.ignore-parse-errors' = 'true', 那么eventTime会被设置为null,此时会报一个异常:
Caused by: java.lang.RuntimeException: RowTime field should not be null, please convert it to a non-null long value.

有没有什么好的方式可以解决


祝好!



18500348251@163.com

Re: flink1.11 sql kafka 抽取事件时间

Posted by Benchao Li <li...@apache.org>.
我感觉可以通过计算列的方式来解决呀,你只需要在计算rowtime这个列的时候保证它不是null即可,如果是null,可以设置一个默认值之类的?

18500348251@163.com <18...@163.com> 于2020年7月15日周三 下午3:04写道:

> 大家好!
>
> 使用flink1.11 sql接入kafka ,format为csv
> 从eventTime字段中抽取事件时间
> rowtime AS TO_TIMESTAMP(FROM_UNIXTIME(eventTime / 1000, 'yyyy-MM-dd
> HH:mm:ss'))
> eventTime可能存在脏数据(非13位的毫秒时间戳),设置了 'csv.ignore-parse-errors' = 'true',
> 那么eventTime会被设置为null,此时会报一个异常:
> Caused by: java.lang.RuntimeException: RowTime field should not be null,
> please convert it to a non-null long value.
>
> 有没有什么好的方式可以解决
>
>
> 祝好!
>
>
>
> 18500348251@163.com
>


-- 

Best,
Benchao Li