Skip to content

[BUG] JDBC Driver doesn't return TIMESTAMP fractional seconds #924

Closed

Description

@kylepbit

What is the bug?
Timestamps with fractional seconds have the fractions stripped through the JDBC driver.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Load data into a timestamp index with fractional seconds
  2. Connect using the JDBC driver
  3. Issue a SELECT * query on the table
  4. Notice no fractional seconds for any values

What is the expected behavior?
Fractional seconds match the inserted values

What is your host/environment?

  • OS: macOS
  • Version JDBC 1.1.0.1
  • Plugins

Activity

  1. added
    bug
    on Oct 17, 2022
  2. Yury-Fridlyand commented on Oct 17, 2022

    @Yury-Fridlyand
    Collaborator

    Test data:
    test_data.zip

  3. MaxKsyunz commented on Oct 18, 2022

    @MaxKsyunz
    Collaborator

    The problem is here.
    image

    This is the definition of DATE_TIME_FORMATTER
    image

    The correct solution should use the formatter specified in the mapping for the field or whatever is set as the default formatter in OpenSearch[*].

    Here are the docs for date field formatters.

    [*] I thought I read somewhere it's a setting, but I can't find it. Default formatters used by OpenSearch are here.

  4. MaxKsyunz commented on Oct 19, 2022

    @MaxKsyunz
    Collaborator

    constructTimestamp should be able to use DateFormatters.forPattern to get date formatter for one of the pre-defined formats.

  5. kylepbit commented on Oct 19, 2022

    @kylepbit
    ContributorAuthor

    I believe this was actually a red herring - it appears to have invoked the v1 SQLEngine which doesn't have timestamp, and thus couldn't return the precision. It's now working correctly after some other changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions