Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Timezone issue when retrieving date from Elasticsearch (UTC considered as local) #1062

Open
milantar opened this issue Feb 25, 2021 · 3 comments
Labels

Comments

@milantar
Copy link

Hello,
It seems that a datefield retrieved by opendistro jdbc (opendistro-sql-jdbc-1.2.0.0.jar) from Elasticsearch (7.2.0) is retrieved as local (displayed in JasperServer).
Elasticsearch stores the date as UTC:
{ "_index" : "record-deletion-logs", "_type" : "_doc", "_id" : "jhTO1HcBu5s5PDfU9iUG", "_score" : 8.962324, "_source" : { ... "operationdate" : "2021-01-18T11:17:41.529Z", }
Afetr querying with opendistro:
select external_id, operationdate from record-deletion-logs WHERE external_id like 100801210112003515%'
the date '2021-01-18 11:17:41.529' is considered local (TZ +1 in my case), so I display the UTC date at the local time. If I override the timezone, the date shifts accordingly, if I force the timezone to UTC the resulting date is '2021-01-18 10:17:41.529'.
Attached a screenshot of the date retrieved from Jasper
DateManagement issue

@jcgraybill
Copy link

Hi @milantar, moving this to the jdbc-driver repo...

@jcgraybill jcgraybill transferred this issue from opendistro-for-elasticsearch/sample-code Feb 25, 2021
@dai-chen dai-chen transferred this issue from amazon-archives/sql-jdbc Feb 25, 2021
@dai-chen dai-chen added the JDBC label Feb 25, 2021
@chloe-zh chloe-zh added SQL and removed JDBC labels Feb 27, 2021
@chloe-zh
Copy link
Member

Hi @milantar thanks for reporting this issue.
I was able to reproduce this issue locally. To my understanding, the query engine sets the system timezone to UTC by default as of now rather than exposes the timezone info directly to the plugin. In general, it should be eligible for users to set custom timezone as system timezone, which is not supported by our engine yet. Would we have any workaround on this? @penghuo @dai-chen

@milantar
Copy link
Author

milantar commented Mar 4, 2021 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants