Skip to content

fix: Preserve TIMESTAMP_LTZ instants in jdbc-sqrl regardless of JVM time zone - #424

Merged
ferenc-csaky merged 1 commit into
mainfrom
fix/jdbc-ltz-timezone
Oct 21, 2026
Merged

ferenc-csaky merged 1 commit into
mainfrom
fix/jdbc-ltz-timezone

Conversation

@ferenc-csaky

Copy link
Copy Markdown
Collaborator

What does this change?

jdbc-sqrl converted TIMESTAMP_LTZ values through the wall-clock methods of java.sql.Timestamp (TimestampData#toTimestamp on write, TimestampData.fromTimestamp on read), which interpret the value in the JVM default time zone. On a JVM that does not run in UTC, every TIMESTAMP_LTZ written to a Postgres timestamptz column was shifted by that zone's offset (e.g. +8h in winter and +7h in summer for America/Los_Angeles), and values read back were shifted in the opposite direction.

Both converters now go through Instant, so the stored and read instant is the same regardless of the JVM time zone. On a JVM that runs in UTC, the behavior is unchanged.

Area

  • Runner CLI and Docker image (flink-sql-runner)
  • Connectors (connectors)
  • Formats (formats)
  • Function libraries (stdlib)
  • Environment utilities (env-utils)
  • Tests and samples (testing)
  • Build / CI / dependencies
  • Docs (README.md, stdlib-docs)

How did you test it?

  • Added SqrlJdbcTimestampLtzTest, which writes a TIMESTAMP_LTZ to Postgres through jdbc-sqrl (Testcontainers) and converts a JDBC Timestamp back, with the JVM time zone set to UTC, America/Los_Angeles and Asia/Kolkata.
  • postgresql-connector tests (20, including the 6 new cases) and spotless:check pass.
  • Ran the FullUseCaseIT suite of DataSQRL main (48 use cases) against this change. That suite runs with TZ=America/Los_Angeles, and 7 snapshots in 5 use cases (avro-schema, filtered-distinct, function-translation/flink, sensors-teaser, simple-with-bigint-support) currently contain the shifted values. With this change, they contain the instants of the source data instead, e.g. 2023-01-02T22:24:00Z instead of 2023-01-03T06:24:00Z. No other snapshot changes. Without this change, all 48 use cases pass.

DataSQRL main consumes 1.0-SNAPSHOT, so those snapshots need to be updated in DataSQRL together with this change.

Checklist

  • The PR title starts with a type such as feat:, fix: or docs:, optionally with a scope (e.g. fix(flexible-json):)
  • mvn clean install passes locally and the code is formatted with mvn spotless:apply (formatted; only the postgresql-connector build and tests were run locally)
  • New or changed behavior is covered by tests (given_when_then naming, AssertJ assertions)
  • New dependency and plugin versions are defined as properties in the root pom.xml (no new dependencies)
  • Commits are signed off and signed (git commit -s -S)
  • README.md and stdlib-docs are updated if user-facing behavior or functions changed (no docs change needed)

🤖 Generated with Claude Code

…ime zone

Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com>
@ferenc-csaky ferenc-csaky added the bug Something isn't working label Oct 21, 2026
@ferenc-csaky ferenc-csaky added this to the 0.12.1 milestone Oct 21, 2026
@ferenc-csaky
ferenc-csaky merged commit f87492e into main Oct 21, 2026
19 checks passed
@ferenc-csaky
ferenc-csaky deleted the fix/jdbc-ltz-timezone branch October 21, 2026 15:11
ferenc-csaky added a commit that referenced this pull request Oct 21, 2026
…ime zone (#424)

Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants