mirror of
https://github.com/apache/impala.git
synced 2026-01-31 09:00:19 -05:00
AVG used to contain a back and forth timezone conversion if use_local_tz_for_unix_timestamp_conversions is true. This could affect the results if there were values from different DST rules. Note that AVG on timestamps has other issues besides this, see IMPALA-7472 for details. Testing: - added a regression test Change-Id: I999099de8e07269b96b75d473f5753be4479cecd Reviewed-on: http://gerrit.cloudera.org:8080/17412 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
114 lines
3.9 KiB
Plaintext
114 lines
3.9 KiB
Plaintext
====
|
|
---- QUERY
|
|
# Tests for unix_micros_to_utc_timestamp().
|
|
# Set timezone to CET to ensure that the local time is never UTC.
|
|
SET timezone=CET;
|
|
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),
|
|
unix_micros_to_utc_timestamp(-17987443200 * 1000000 - 1);
|
|
---- TYPES
|
|
TIMESTAMP,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,NULL
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
SET timezone=CET;
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
SELECT
|
|
from_unixtime(0),
|
|
from_unixtime((40 * 365) * 24 * 60 * 60),
|
|
from_unixtime((180 + 40 * 365) * 24 * 60 * 60);
|
|
---- TYPES
|
|
STRING,STRING,STRING
|
|
---- RESULTS
|
|
'1970-01-01 01:00:00','2009-12-22 01:00:00','2010-06-20 02:00:00'
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
set timezone="America/Los_Angeles";
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
SELECT
|
|
from_unixtime(0),
|
|
from_unixtime((40 * 365) * 24 * 60 * 60),
|
|
from_unixtime((180 + 40 * 365) * 24 * 60 * 60);
|
|
---- TYPES
|
|
STRING,STRING,STRING
|
|
---- RESULTS
|
|
'1969-12-31 16:00:00','2009-12-21 16:00:00','2010-06-19 17:00:00'
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
SET timezone=CET;
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
SELECT
|
|
unix_timestamp('1970-01-01 01:00:00'),
|
|
unix_timestamp('2009-12-22 01:00:00'),
|
|
unix_timestamp('2010-06-20 02:00:00');
|
|
---- TYPES
|
|
BIGINT,BIGINT,BIGINT
|
|
---- RESULTS
|
|
0,1261440000,1276992000
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
set timezone="America/Los_Angeles";
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
SELECT
|
|
unix_timestamp('1969-12-31 16:00:00'),
|
|
unix_timestamp('2009-12-21 16:00:00'),
|
|
unix_timestamp('2010-06-19 17:00:00');
|
|
---- TYPES
|
|
BIGINT,BIGINT,BIGINT
|
|
---- RESULTS
|
|
0,1261440000,1276992000
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
SET timezone=CET;
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
select cast(0 as timestamp);
|
|
---- TYPES
|
|
TIMESTAMP
|
|
---- RESULTS
|
|
1970-01-01 01:00:00
|
|
====
|
|
---- QUERY
|
|
# This following test is copied from local-timestamp-functions.test as from IMPALA-10171
|
|
# flag use_local_tz_for_unix_timestamp_conversions can be overriden with a query option.
|
|
# TODO: remove/reduce this test duplication
|
|
SET timezone="America/Los_Angeles";
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
select cast(0 as timestamp);
|
|
---- TYPES
|
|
TIMESTAMP
|
|
---- RESULTS
|
|
1969-12-31 16:00:00
|
|
====
|
|
---- QUERY
|
|
# Regression test for IMPALA-5121. AVG used to contain a back and forth timezone
|
|
# conversion (if use_local_tz_for_unix_timestamp_conversions is true) that could affect
|
|
# the results if there were values from different DST rules.
|
|
SET timezone=CET;
|
|
SET use_local_tz_for_unix_timestamp_conversions=1;
|
|
select avg(timestamp_col) from functional.alltypestiny;
|
|
---- TYPES
|
|
TIMESTAMP
|
|
---- RESULTS
|
|
2009-02-15 00:00:30
|
|
==== |