[
https://issues.apache.org/jira/browse/FLINK-26672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507455#comment-17507455
]
Yao Zhang commented on FLINK-26672:
-----------------------------------
Hi all,
I tested in my 1.13.1 local environment but cannot reproduce your issue.
{code:java}
val environment = StreamExecutionEnvironment.getExecutionEnvironment
environment.setParallelism(1)
val tEnv = StreamTableEnvironment.create(environment)
// tEnv.getConfig.getConfiguration.setString("table.local-time-zone",
"Asia/Shanghai")
tEnv.getConfig.getConfiguration.setString("table.local-time-zone",
"America/Los_Angeles")
// tEnv.getConfig.getConfiguration.setString("table.local-time-zone", "UTC")
tEnv.executeSql("create table demo (`ts` bigint, `time` as
to_timestamp_ltz(ts, 3), `constant` as to_timestamp_ltz(1647402695000, 3)) with
('connector'='filesystem', 'path'='/some/path/demo.txt', 'format'='csv')")
tEnv.executeSql("select * from demo").print() {code}
The mocked data in /some/path/demo.txt is 1647402695000。
The result is that both time and constant columns change together along with
"table.local-time-zone".
I suggest you try the example in [Time Zone | Apache
Flink|https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/timezone/]:
{code:java}
Flink SQL> CREATE VIEW T1 AS SELECT TO_TIMESTAMP_LTZ(4001, 3);
Flink SQL> SET 'table.local-time-zone' = 'UTC';
Flink SQL> SELECT * FROM T1;
+---------------------------+
| TO_TIMESTAMP_LTZ(4001, 3) |
+---------------------------+
| 1970-01-01 00:00:04.001 |
+---------------------------+
Flink SQL> SET 'table.local-time-zone' = 'Asia/Shanghai';
Flink SQL> SELECT * FROM T1;
+---------------------------+
| TO_TIMESTAMP_LTZ(4001, 3) |
+---------------------------+
| 1970-01-01 08:00:04.001 |
+---------------------------+ {code}
And check whether it works or not.
> In Table/SQL API, Table configuration ' table.local-time-zone' does not work
> ----------------------------------------------------------------------------
>
> Key: FLINK-26672
> URL: https://issues.apache.org/jira/browse/FLINK-26672
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.13.1
> Reporter: RuiLin-Zhang
> Priority: Major
> Fix For: 1.13.1
>
>
> I created a table structure
> {color:#ff0000}tabEnv.getConfig.getConfiguration.setString("table.local-time-zone",
> "Asia/Shanghai"){color}
> create table dwd_event_kafka (
> `platform` bigint,
> `ts` bigint,
> `event_ts` as to_timestamp_ltz(ts,3),
> `log_time` bigint,
> `event` integer,
> `page` integer,
> `guid` string,
> `goods_id` bigint,
> `third_class_id` bigint,
> `main_goods_id` bigint,
> `event_time` as to_timestamp_ltz(log_time,3),
> watermark for event_time as event_time - interval '5' second
> ) with (
> 'connector' = 'kafka',
> ...
> )
> > +I[101, 1647402695000, 2022-03-16T03:51:35Z, 1647402698149, 101, 131001,
> > 22547286, 8005242, 471, 8005242, 2022-03-16T03:51:38.149Z]
> I found is wrong, the output data converted by to_timestamp_ltz function . I
> tried to configure {color:#ff0000}"table.local-time-zone"{color} and found it
> didn't work.
>
> In Shanghai time zone,the timestamp(1647402695000 ) should be
> "2022-03-16T11:51:35Z" instead of "2022-03-16T03:51:35Z" .
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)