Repository: incubator-impala Updated Branches: refs/heads/master bd6577e3c -> 6ff54ab3b
IMPALA-3504: [DOCS] Document utc_timestamp() This function seems to be related to unix_micros_to_utc_timestamp() and utc_to_unix_micros() which are also not currently documented. Did they all come in at the same time or have the *unix_micros* ones existed for a while? Change-Id: Ia2662fc79d588f22a24a5067429a57b3c0d0f0f0 Reviewed-on: http://gerrit.cloudera.org:8080/8190 Reviewed-by: Greg Rahn <[email protected]> Reviewed-by: Lars Volker <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/6ff54ab3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/6ff54ab3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/6ff54ab3 Branch: refs/heads/master Commit: 6ff54ab3b65194cc020a1228b3596346bc5a4013 Parents: bd6577e Author: John Russell <[email protected]> Authored: Sun Oct 1 23:35:50 2017 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Fri Oct 6 19:10:22 2017 +0000 ---------------------------------------------------------------------- docs/topics/impala_datetime_functions.xml | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6ff54ab3/docs/topics/impala_datetime_functions.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_datetime_functions.xml b/docs/topics/impala_datetime_functions.xml index 5c75725..c0e3473 100644 --- a/docs/topics/impala_datetime_functions.xml +++ b/docs/topics/impala_datetime_functions.xml @@ -2516,6 +2516,62 @@ select unix_timestamp </dlentry> + <dlentry id="utc_timestamp" rev="2.10.0 IMPALA-3504"> + + <dt> + <codeph>utc_timestamp()</codeph> + </dt> + + <dd> + <indexterm audience="hidden">utc_timestamp() function</indexterm> + <b>Purpose:</b> Returns a <codeph>TIMESTAMP</codeph> corresponding to the current + date and time in the UTC time zone. + <p> + <b>Return type:</b> <codeph>timestamp</codeph> + </p> + <p conref="../shared/impala_common.xml#common/added_in_210"/> + <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/> + <p> + Similar to the <codeph>now()</codeph> or <codeph>current_timestamp()</codeph> functions, + but does not use the local time zone as those functions do. Use <codeph>utc_timestamp()</codeph> + to record <codeph>TIMESTAMP</codeph> values that are interoperable with + servers around the world, in arbitrary time zones, without the need for + additional conversion functions to standardize the time zone of each + value representing a date/time. + </p> + <p> + For working with date/time values represented as integer values, you can convert + back and forth between <codeph>TIMESTAMP</codeph> and <codeph>BIGINT</codeph> + with the <codeph>unix_micros_to_utc_timestamp()</codeph> and + <codeph>utc_to_unix_micros()</codeph> functions. The integer values represent + the number of microseconds since the Unix epoch (midnight on January 1, 1970). + </p> + <p conref="../shared/impala_common.xml#common/example_blurb"/> + <p> + The following example shows how <codeph>now()</codeph> and <codeph>current_timestamp()</codeph> + represent the current date/time in the local time zone (in this case, UTC-7), while + <codeph>utc_timestamp()</codeph> represents the same date/time in the standardized UTC + time zone: + </p> +<codeblock> +select now(), utc_timestamp(); ++-------------------------------+-------------------------------+ +| now() | utc_timestamp() | ++-------------------------------+-------------------------------+ +| 2017-10-01 23:33:58.919688000 | 2017-10-02 06:33:58.919688000 | ++-------------------------------+-------------------------------+ + +select current_timestamp(), utc_timestamp(); ++-------------------------------+-------------------------------+ +| current_timestamp() | utc_timestamp() | ++-------------------------------+-------------------------------+ +| 2017-10-01 23:34:07.400642000 | 2017-10-02 06:34:07.400642000 | ++-------------------------------+-------------------------------+ +</codeblock> + </dd> + + </dlentry> + <dlentry id="weekofyear"> <dt>
