mirror of
https://github.com/apache/impala.git
synced 2026-01-02 03:00:32 -05:00
The -use_local_tz_for_unix_timestamp_conversion flag exists to specify if TIMESTAMPs should be interpreted as localtime or UTC when converting to/from Unix time via builtins: from_unixtime(bigint unixtime) unix_timestamp(string datetime[, ...]) unix_timestamp(timestamp datetime) However, the KuduScanner was calling into code that, when the gflag above was set, interpreted Unix times as local time. Unfortunately the write path (KuduTableSink) and some FE TIMESTAMP code (see KuduUtil.java) did not have this behavior, i.e. we were handling the gflag inconsistently. Tests: * Adds a custom cluster test to run Kudu test cases with -use_local_tz_for_unix_timestamp_conversion. * Adds tests for the new builtin unix_micros_to_utc_timestamp() which run in a custom cluster test (added test_local_tz_conversion.py) as well as in the regular tests (added to test_exprs.py). Change-Id: I423a810427353be76aa64442044133a9a22cdc9b Reviewed-on: http://gerrit.cloudera.org:8080/7311 Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com> Tested-by: Impala Public Jenkins
17 lines
623 B
Plaintext
17 lines
623 B
Plaintext
====
|
|
---- QUERY
|
|
# Tests for unix_micros_to_utc_timestamp().
|
|
# TODO: after fixing IMPALA-5664, add test for -17987443200 * 1000000 - 1
|
|
SELECT
|
|
unix_micros_to_utc_timestamp(NULL),
|
|
unix_micros_to_utc_timestamp(0),
|
|
unix_micros_to_utc_timestamp(1),
|
|
unix_micros_to_utc_timestamp(-17987443200 * 1000000),
|
|
unix_micros_to_utc_timestamp(253402300799 * 1000000),
|
|
unix_micros_to_utc_timestamp(253402300799 * 1000000 + 1);
|
|
---- TYPES
|
|
TIMESTAMP,TIMESTAMP,TIMESTAMP,TIMESTAMP,TIMESTAMP,TIMESTAMP
|
|
---- RESULTS
|
|
NULL,1970-01-01 00:00:00,1970-01-01 00:00:00.000001000,1400-01-01 00:00:00,9999-12-31 23:59:59,9999-12-31 23:59:59.000001000
|
|
====
|