Skip to content

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

Closed

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.

Activity

  1. added
    bug
    on Jul 17, 2023
  2. acarbonetto commented on Jul 17, 2023

    @acarbonetto
    CollaboratorAuthor

    #1031 available as a workaround

  3. added
    PPL
    on May 29, 2025
  4. LantaoJin commented on Aug 11, 2025

    @LantaoJin
    Member

    Resolved in v3 #3854

  5. moved this from Not Started to Done in PPL Trackeron Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLSQLbug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions