Zoltan Borok-Nagy has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/18675 )

Change subject: IMPALA-11368: Iceberg time-travel error message should show 
timestamp in local timezone
......................................................................


Patch Set 4:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/18675/4/fe/src/main/java/org/apache/impala/analysis/TimeTravelSpec.java
File fe/src/main/java/org/apache/impala/analysis/TimeTravelSpec.java:

http://gerrit.cloudera.org:8080/#/c/18675/4/fe/src/main/java/org/apache/impala/analysis/TimeTravelSpec.java@120
PS4, Line 120:     timeZoneId_ = 
ZoneId.of(analyzer.getQueryCtx().getLocal_time_zone());
https://gerrit.cloudera.org/#/c/9986/ added support for custom timezone 
databases and timezone aliases, but it is only for the C++ backend, Java uses 
its own timezone database.

One problem could be if the specified timezone is not known by the Java 
timezone database. Maybe we can just catch the exception and fallback to UTC. 
I'm OK with that solution.

Other problem can be, which is probably unlikely is that there's inconsistency 
between the Java timezone database and Impala backend's database.

Probably the best solution to these problems is that if we let the backend do 
the conversions. An example to that can be seen here: 
https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/util/ExprUtil.java#L42-L47

So we need to construct something like the following:

 from_utc_timestamp(cast('<UTC timestamp literal>' as timestamp), '<user's 
local timezone>');

 E.g.:

 from_utc_timestamp(cast('2022-06-29 18:12:31.829776000' as timestamp), 
'Asia/Shanghai');

Might need to add a cast expression to STRING on top of it, so it will be easy 
to output the resulting TColumnValue.



--
To view, visit http://gerrit.cloudera.org:8080/18675
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iba5d5eb65133f11cc4eb2fc15a19f7b25c14cc46
Gerrit-Change-Number: 18675
Gerrit-PatchSet: 4
Gerrit-Owner: Anonymous Coward <[email protected]>
Gerrit-Reviewer: Anonymous Coward <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Tamas Mate <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
Gerrit-Comment-Date: Wed, 29 Jun 2022 16:30:35 +0000
Gerrit-HasComments: Yes

Reply via email to