Files
impala/testdata/workloads/functional-query/queries/QueryTest/utc-timestamp-functions.test
Csaba Ringhofer 5dccf8024b IMPALA-10171: Create query options for local time related flags
convert_legacy_hive_parquet_utc_timestamps and
use_local_tz_for_unix_timestamp_conversions were controllable only by
flags until now. After this change the old flags are only used on the
Coordinator to set the defaults for the query options.

If default_query_options also sets these query options, it will
take precedence over the old flags.

Possible follow up work:
- the old flags could be deprecated, as default_query_options
  can be used to set this on a server level
- testing these functionalities no longer needs custom cluster
  tests - rewriting the existing tests could speed up test
  execution

Testing:
- expr-test was rewritten to use the query option instead of the flag
- extended the custom cluster tests for the old flags to also use the
  query options
- ran related tests

Change-Id: I5c4252d1c8f8e224c1d0e8234f09374bcc0c6f68
Reviewed-on: http://gerrit.cloudera.org:8080/16469
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-09-18 22:12:47 +00:00

103 lines
3.5 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
====