Skip to content

[BUG] Timezone issue when retrieving date from Opensearch (UTC considered as local) #1874

@acarbonetto

Description

@acarbonetto

What is the bug?
Copy of opendistro-for-elasticsearch/sql#1062

How can one reproduce the bug?

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

https://user-images.githubusercontent.com/43438796/109149602-15bdda80-7768-11eb-9a2b-0b59b2ab3509.PNG

What is the expected behavior?
A clear and concise description of what you expected to happen.

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

PPLPiped processing languageSQLbugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions