[ https://issues.apache.org/jira/browse/BEAM-9709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17082745#comment-17082745 ]
Yueyang Qiu edited comment on BEAM-9709 at 4/13/20, 11:46 PM: -------------------------------------------------------------- OK. I agree this is a bug in ZetaSQL. I run {code:java} String expr = "cast(timestamp('2015-04-01') as string)"; try (PreparedExpression exp = new PreparedExpression(expr)) { AnalyzerOptions options = new AnalyzerOptions(); options.setDefaultTimezone("Asia/Shanghai"); exp.prepare(options); Value value = exp.execute(); System.out.println(value.getStringValue()); } {code} and the result is {code:java} 2015-04-01 00:00:00-07 {code} which means setDefaultTimezone() does something wrong while running the timestamp() constructor, but it works fine while running cast() (see the second part of the test: [https://github.com/google/zetasql/blob/7d983d3632702f200c8340933160c02f1d94e5a7/javatests/com/google/zetasql/PreparedExpressionTest.java#L375]) was (Author: robinyqiu): OK. This seems to be a bug in ZetaSQL. I run {code:java} String expr = "cast(timestamp('2015-04-01') as string)"; try (PreparedExpression exp = new PreparedExpression(expr)) { AnalyzerOptions options = new AnalyzerOptions(); options.setDefaultTimezone("Asia/Shanghai"); exp.prepare(options); Value value = exp.execute(); System.out.println(value.getStringValue()); } {code} and the result is {code:java} 2015-04-01 00:00:00-07 {code} which means setDefaultTimezone() does something wrong while running the timestamp() constructor, but it works fine while running cast() (see the second part of the test: https://github.com/google/zetasql/blob/7d983d3632702f200c8340933160c02f1d94e5a7/javatests/com/google/zetasql/PreparedExpressionTest.java#L375) > timezone off by 8 hours > ----------------------- > > Key: BEAM-9709 > URL: https://issues.apache.org/jira/browse/BEAM-9709 > Project: Beam > Issue Type: Bug > Components: dsl-sql-zetasql > Reporter: Andrew Pilloud > Assignee: Yueyang Qiu > Priority: Trivial > Labels: zetasql-compliance > > two failures in shard 13, one failure in shard 19 > {code} > Expected: ARRAY<STRUCT<TIMESTAMP>>[{2014-01-31 00:00:00+00}] > Actual: ARRAY<STRUCT<$col1 TIMESTAMP>>[{2014-01-31 08:00:00+00}], > {code} > {code} > select timestamp(date '2014-01-31') > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)