[MCOL-3868] unix_timestamp() output incorrect when time_zone is not 0:00 Created: 2020-03-04  Updated: 2021-07-08  Resolved: 2021-07-08

Status: Closed
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: 1.4.3
Fix Version/s: 1.4.5

Type: Bug Priority: Minor
Reporter: Gagan Goel (Inactive) Assignee: Gagan Goel (Inactive)
Resolution: Won't Do Votes: 0
Labels: None

Issue Links:
PartOf
is part of MCOL-3594 Failed tests in the 001 suite in 1.4 Closed
is part of MCOL-3869 Use the server time_zone system varia... Closed
Epic Link: Time, Timestamp and Timezone

 Description   

The unix_timestamp() function is not using the current time_zone variable value for calculations, when this value is non-zero. Here are steps to reproduce:

MariaDB [test]> create table i1 (a date, b date);
Query OK, 0 rows affected (0.025 sec)
 
MariaDB [test]> insert into i1 values ('2009-07-04', '1980-01-01');
Query OK, 1 row affected (0.001 sec)
 
MariaDB [test]> create table c1 (a date, b date)engine=columnstore;
Query OK, 0 rows affected (1.548 sec)
 
MariaDB [test]> insert into c1 values ('2009-07-04', '1980-01-01');
Query OK, 1 row affected (0.227 sec)
 
MariaDB [test]> set time_zone='+0:00';
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from i1;
+------------+------------+-------------------+-------------------+
| a          | b          | unix_timestamp(a) | unix_timestamp(b) |
+------------+------------+-------------------+-------------------+
| 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
+------------+------------+-------------------+-------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from c1;
+------------+------------+-------------------+-------------------+
| a          | b          | unix_timestamp(a) | unix_timestamp(b) |
+------------+------------+-------------------+-------------------+
| 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
+------------+------------+-------------------+-------------------+
1 row in set (0.040 sec)
 
MariaDB [test]> set time_zone='-5:00';
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from i1;
+------------+------------+-------------------+-------------------+
| a          | b          | unix_timestamp(a) | unix_timestamp(b) |
+------------+------------+-------------------+-------------------+
| 2009-07-04 | 1980-01-01 |        1246683600 |         315550800 |
+------------+------------+-------------------+-------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from c1;
+------------+------------+-------------------+-------------------+
| a          | b          | unix_timestamp(a) | unix_timestamp(b) |
+------------+------------+-------------------+-------------------+
| 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
+------------+------------+-------------------+-------------------+
1 row in set (0.008 sec)



 Comments   
Comment by David Hall (Inactive) [ 2020-03-04 ]

The problem is that Columnstore uses the system setting for timezone. MariaDB has it's own timezone settings.
In this case, if the test is run on a system that has a timezone with daylight savings, the results differ than if run on a UTC machine such as AWS.
From previous work, the MariaDB timezone setting is available in PrimProc and ExeMgr, so this can be used to make Columnstore match MariaDB. Then, by setting the timezone during the test, results will be consistent.

Generated at Thu Feb 08 02:46:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.