impala-reviews mailing list archives

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

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


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/4490/3/be/src/service/impala-server.cc
File be/src/service/impala-server.cc:

PS3, Line 842:   typedef boost::date_time::c_local_adjustor<ptime> local_adj;
             :   const ptime& utime = boost::posix_time::microsec_clock::universal_time();
             :   const ptime& ltime = local_adj::utc_to_local(utime);
             :   query_ctx->__set_now_string(TimestampValue(ltime).DebugString());
             :   query_ctx->__set_now_utc_string(TimestampValue(utime).DebugString());
This is a bit tricky because we're trying to get 1 timestamp and do the conversion. I think
it'd just be easier to get the utc timestamp (boost::posix_time::microsec_clock::universal_time())
and then separately get the local time timestamp (TimstampVal::LocalTime()). I don't think
it's a big deal that they're slightly different readings, the functions don't guarantee anything
about them being equivalent. The important thing about capturing them here is that we don't
have to worry about getting different values on different machines at different times, i.e.
that the udf returns different values depending on when the code happens to run.


-- 
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: 3
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: Yes

Mime
View raw message