blob: a74ef68ab86f9e8aa9f7feceae349805c717905f [file] [log] [blame]
====
---- 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
====