impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Youwei Wang (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-3504: function for current timestamp in UTC, i.e. utc timestamp()
Date Wed, 21 Sep 2016 08:48:22 GMT
Youwei Wang has posted comments on this change.

Change subject: IMPALA-3504: function for current timestamp in UTC, i.e. utc_timestamp()
......................................................................


Patch Set 1:

> As I mentioned in your previous review and/or the JIRA, this needs
 > to use the query-wide timestamp, i.e. what we do for now().

Greetings, Matthew.
If you don't mind, I want to propose an idea about this task.
Considering three fators of utc_timestamp, local_timestamp and timezone, I believe we have
following deductions:
utc_timestamp + local_timestamp → timezone
utc_timestamp + timezone → local_timestamp 
local_timestamp + timezone → utc_timestamp 
PS: So far as I know, the UTC time is essentially the time without any timezone offset. If
you don't mind, I want to take the Beijing time as example. Since Beijing timezone is of +8h
offset, I can get corresponding UTC time by minusing 8 from current Beijing time. I have done
some calculation and calibration using online time service. And this approach works. If you
find some mistakes in my approach, please feel free to point them out. Thank you. :)

And I have found the following code:
query_ctx->__set_now_string(TimestampValue::LocalTime().DebugString());
in be/src/service/impala-server.cc:841. 
So please allow me to assume we have local_timestamp of the host where Impala service runs.
In this case, we can:
1. directly store the utc_timestamp in the context data structure. Then utc_timestamp() can
be accessed like the function now(). 
2. save the timezone/offset in the context data structure. Then we can use the now() and such
timezone/offset to calculate the utc_timestamp.

If possbile, would you please tell which solution you prefer? 
Thank you for reading this long post. :)

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5ee6ee192aa469f77c711f27ad324696a42004d1
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Youwei Wang <youwei.a.wang@intel.com>
Gerrit-Reviewer: Jim Apple <jbapple@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj@cloudera.com>
Gerrit-Reviewer: Youwei Wang <youwei.a.wang@intel.com>
Gerrit-HasComments: No

Mime
View raw message