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 hb <34...@163.com> on 2020/05/01 09:26:35 UTC
flink sql 处理时间 时区问题
``` 代码
val env = StreamExecutionEnvironment.getExecutionEnvironment
val settings: EnvironmentSettings = EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env, settings)
val t2 = env.fromElements("a", "b", "c")
t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
```
// 时区上海, 当前时间为 2020-05-01 15点
// 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.
Re: flink sql 处理时间 时区问题
Posted by Jark Wu <im...@gmail.com>.
Yes. This is the same problem with CURRENT_TIMESTAMP which was asked before
in mailing list and JIRA.
Changing the return type to WITH LOCAL TIME ZONE is not a small work, we
should make event-time and watermark support this type.
But I think this is in a high priority and should be fixed in the next
release.
Best,
Jark
On Wed, 6 May 2020 at 09:47, Jingsong Li <ji...@gmail.com> wrote:
> Hi,
>
> 这可能是个Bug。
>
> Blink中默认使用timestamp WITHOUT time zone,所以它是无时区的。
> 而proctime目前还是带时区的产生了时间,我理解可能是应该产生无时区的时间。
>
> CC: @Jark Wu <im...@gmail.com> @Zhenghua Gao <do...@gmail.com>
>
> Best,
> Jingsong Lee
>
> On Tue, May 5, 2020 at 5:43 PM 祝尚 <17...@163.com> wrote:
>
>> 同问,等待大佬回答
>>
>> > 2020年5月1日 下午5:26,hb <34...@163.com> 写道:
>> >
>> >
>> >
>> > ``` 代码
>> > val env = StreamExecutionEnvironment.getExecutionEnvironment
>> > val settings: EnvironmentSettings =
>> EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
>> > val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env,
>> settings)
>> >
>> >
>> > val t2 = env.fromElements("a", "b", "c")
>> > t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
>> > ```
>> >
>> >
>> > // 时区上海, 当前时间为 2020-05-01 15点
>> > // 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.
>>
>>
>
> --
> Best, Jingsong Lee
>
Re: flink sql 处理时间 时区问题
Posted by Jingsong Li <ji...@gmail.com>.
Hi,
这可能是个Bug。
Blink中默认使用timestamp WITHOUT time zone,所以它是无时区的。
而proctime目前还是带时区的产生了时间,我理解可能是应该产生无时区的时间。
CC: @Jark Wu <im...@gmail.com> @Zhenghua Gao <do...@gmail.com>
Best,
Jingsong Lee
On Tue, May 5, 2020 at 5:43 PM 祝尚 <17...@163.com> wrote:
> 同问,等待大佬回答
>
> > 2020年5月1日 下午5:26,hb <34...@163.com> 写道:
> >
> >
> >
> > ``` 代码
> > val env = StreamExecutionEnvironment.getExecutionEnvironment
> > val settings: EnvironmentSettings =
> EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
> > val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env,
> settings)
> >
> >
> > val t2 = env.fromElements("a", "b", "c")
> > t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
> > ```
> >
> >
> > // 时区上海, 当前时间为 2020-05-01 15点
> > // 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.
>
>
--
Best, Jingsong Lee
Re: flink sql 处理时间 时区问题
Posted by 祝尚 <17...@163.com>.
同问,等待大佬回答
> 2020年5月1日 下午5:26,hb <34...@163.com> 写道:
>
>
>
> ``` 代码
> val env = StreamExecutionEnvironment.getExecutionEnvironment
> val settings: EnvironmentSettings = EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
> val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env, settings)
>
>
> val t2 = env.fromElements("a", "b", "c")
> t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
> ```
>
>
> // 时区上海, 当前时间为 2020-05-01 15点
> // 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.
Re: Re:flink sql 处理时间 时区问题
Posted by 刘大龙 <ld...@zju.edu.cn>.
Hi,
一种简单的方式,自己手动在proctime上加8个小时,目前这个时区设置好像是不起作用的。
> -----原始邮件-----
> 发件人: hb <34...@163.com>
> 发送时间: 2020-05-12 13:02:44 (星期二)
> 收件人: user-zh@flink.apache.org
> 抄送:
> 主题: Re:flink sql 处理时间 时区问题
>
> 有人能帮忙看下这个问题么
>
>
>
> 在 2020-05-01 16:26:35,"hb" <34...@163.com> 写道:
>
>
>
> ``` 代码
> val env = StreamExecutionEnvironment.getExecutionEnvironment
> val settings: EnvironmentSettings = EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
> val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env, settings)
>
>
> val t2 = env.fromElements("a", "b", "c")
> t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
> ```
>
>
> // 时区上海, 当前时间为 2020-05-01 15点
> // 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.
>
>
>
>
>
------------------------------
刘大龙
浙江大学 控制系 智能系统与控制研究所 工控新楼217
地址:浙江省杭州市浙大路38号浙江大学玉泉校区
Tel:18867547281
Re:flink sql 处理时间 时区问题
Posted by hb <34...@163.com>.
有人能帮忙看下这个问题么
在 2020-05-01 16:26:35,"hb" <34...@163.com> 写道:
``` 代码
val env = StreamExecutionEnvironment.getExecutionEnvironment
val settings: EnvironmentSettings = EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
val tEnv: StreamTableEnvironment = StreamTableEnvironment.create(env, settings)
val t2 = env.fromElements("a", "b", "c")
t2.toTable(tEnv, 'f1, 'proc.proctime).toAppendStream[Row].print()
```
// 时区上海, 当前时间为 2020-05-01 15点
// 结果显示 a,2020-05-01T09:11:05.633, 处理时间相差8小时, 请问如何让 proctime 结果显示不差8小时.