prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.01k stars 5.36k forks source link

Added a new JDBC driver parameter - 'TimeZoneID' #16680

Open rohanpednekar opened 3 years ago

rohanpednekar commented 3 years ago

Timestamp which is created with UTC timezone is not reflecting the same timezone when queried from Tableau. Instead, tableau gives a timezone local to the machine where it is running.

Repro steps:

  1. Create a table with timestamp column defaulted to UTC in mysql
CREATE TABLE `msgs` (
    `id` INT PRIMARY KEY AUTO_INCREMENT,
    `msg` VARCHAR(256),
    `ts_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP)

Insert a sample value insert into msgs (msg) values('test');

  1. If queried via presto cli it shows local timezone but when forced to use UTC as shown below then the correct value appears

java -Duser.timezone=UTC -jar presto --server https://preddy.ahana-test.cp.ahana.cloud:443 --catalog ttt --user prabhakar --password --debug

  1. Query this table from Tableau via Presto will not return timestamp in UTC.

Adding a new JDBC driver parameter - 'TimeZoneID' similar to trino PR 7252 may fix this issue.

v-jizhang commented 3 years ago

Wating for Trino PR7252 to be merged.

v-jizhang commented 3 years ago

@rohanpednekar PR submitted. With this change, Presto can accept parameter timeZoneID but it relies on the client to pass the parameter. Currently neither presto-cli nor Tableau has that option. After this PR is merged, we should add an option to presto-cli.

rohanpednekar commented 3 years ago

Thanks @v-jizhang for your contribution. We will get this reviewed.

dnskr commented 2 years ago

@rohanpednekar The issue could be closed as implemented and released.