Flight SQL JDBC: Fix timezone/timestamp handling

Open
#732 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
databases

Research direction

Start by tracing the Flight SQL JDBC driver's handling of java.sql.Timestamp, LocalDateTime, time zones, and Calendar, comparing the behavior with the PostgreSQL JDBC expectations described in the issue. Done means naive timestamps preserve the requested wall-clock value and zoned timestamps preserve the UTC instant, including behavior across DST transitions.

Written by the indexing model from the issue text.

Description

Type: enhancement
Describe the enhancement requested

I believe the JDBC driver is handling timezones/timestamps/java.sql.Timestamp entirely incorrectly.

  • Timestamps are round-tripped through LocalDateTime always. I believe this is wrong for timestamps with timezones: we should not round trip through a wall clock time since the same wall clock time may correspond to multiple different instants (during a DST transition)

  • From experimenting with the PostgreSQL JDBC driver, it appears that when requesting a java.sql.Timestamp, the expected behavior is:

    • Naive timestamp: return a Timestamp that appears to have the right wall clock time in the given Calendar, or the system time zone if no calendar is supplied. (In other words, use Timestamp as a janky LocalDateTime.)
    • Zoned timestamp: return a Timestamp whose value is the timestamp in UTC. (In other words, use Timestamp as an Instant.)

    It appears our driver does not do this properly.

Dominant language
Java
Stars
95
Forks
154
Avg merge
2d 10h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-java

All issues in apache/arrow-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.