GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(bigquery-jdbc): preserve civil digits for DATETIME/DATE by keshavdandeva · Pull Request #14910 · googleapis/google-cloud-java

Conversation

@keshavdandeva

@keshavdandeva keshavdandeva commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

b/577457022

Summary

Prevents JVM default timezone DST gaps and historical calendar shifts from corrupting timezone-less civil temporal types (DATETIME, DATE, TIME) when accessed as java.sql.Date, java.sql.Time, or formatted inside ARRAY and STRUCT.

Root Cause

  1. Date / Time extraction from DATETIME: BigQueryBaseResultSet (getDate, getTime, getObject(int, Class)) and BigQueryTypeRegistry (createDatetimeDescriptor) boxed DATETIME values into an intermediate java.sql.Timestamp in the JVM default timezone before extracting Date or Time. When a DATETIME value fell inside a local DST spring-forward gap (e.g., 2025-03-09 02:30:00 in America/New_York), the intermediate Timestamp shifted the wall-clock hour forward by +1 hour (03:30:00).
  2. ARRAY / STRUCT string formatting: BigQueryBaseArray.toString() and BigQueryBaseStruct.appendJsonValue() called .toString() on boxed java.sql.Timestamp / java.sql.Date elements, corrupting ARRAY<DATETIME> / STRUCT<DATETIME> values in DST gaps and ARRAY<DATE> / STRUCT<DATE> values prior to the 1582 Julian–Gregorian cutover.

Changes

  • BigQueryTemporalUtility: Added isCivilTemporalType and formatCivilTemporalElement to centralize civil type checks and format raw DATE, TIME, and DATETIME elements directly from their unshifted civil representation.
  • BigQueryTypeRegistry: Unified createDatetimeDescriptor to parse DATETIME into LocalDateTime once and project directly to Date, Time, LocalDate, LocalTime, LocalDateTime, String, or instant views without intermediate Timestamp boxing.
  • BigQueryBaseResultSet: Updated getObject, getDate, getTime, and getTimestamp to pass raw unboxed values for civil temporal types (DATE, TIME, DATETIME) to BigQueryTypeRegistry.
  • BigQueryBaseArray & BigQueryBaseStruct: Updated string/JSON formatting to format civil temporal elements directly from raw values via BigQueryTemporalUtility.formatCivilTemporalElement.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@keshavdandeva
fix(bigquery-jdbc): preserve civil digits for DATETIME/DATE across Da…
5b7231d
…te, Time, Array, and Struct accessors
@keshavdandeva
keshavdandeva requested review from a team as code owners November 3, 2026 18:23
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 3, 2026
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the handling of civil temporal types (DATE, TIME, and DATETIME) in the BigQuery JDBC driver to prevent timezone conversion issues, particularly during Daylight Saving Time (DST) gaps. It introduces utility methods in BigQueryTemporalUtility to format civil temporal elements for complex types like arrays and structs without boxing them through java.sql types, and simplifies retrieval logic in BigQueryBaseResultSet and BigQueryTypeRegistry. The review feedback highlights a critical issue in the new unit test testDatetimeReadCoercionsPreserveCivilDigits where the JVM-wide default timezone is modified without being restored, which could lead to test pollution and flaky tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryTypeRegistryTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@keshavdandeva
keshavdandeva requested review from Neenu1995 and logachev November 4, 2026 11:28
@keshavdandeva
Merge branch 'main' into jdbc/fix-dst-for-datetime
d9ac90d
Neenu1995
Neenu1995 reviewed Nov 4, 2026
View reviewed changes
Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryTemporalUtility.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryTypeRegistry.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@keshavdandeva
address pr feedback nits
00d11a8
@keshavdandeva
keshavdandeva requested a review from Neenu1995 November 4, 2026 18:42
@keshavdandeva
Merge branch 'main' into jdbc/fix-dst-for-datetime
2e67500
Neenu1995
Neenu1995 approved these changes Nov 4, 2026
View reviewed changes
@keshavdandeva
keshavdandeva merged commit 53bbde0 into main Nov 4, 2026
200 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@keshavdandeva
keshavdandeva deleted the jdbc/fix-dst-for-datetime branch November 4, 2026 19:38
@release-please release-please Bot mentioned this pull request Nov 5, 2026
chore(main): release 1.96.0 #14934
Merged
jinseopkim0 pushed a commit that referenced this pull request Nov 5, 2026
@release-please
chore(main): release 1.96.0 (#14934)
524d6c9
🤖 I have created a release *beep* *boop*
---


<details><summary>1.96.0</summary>

##
[1.96.0](v1.95.0...v1.96.0)
(2026-11-05)


### Features

* **gax:** wire-level changes for resuming uploads
([#14870](#14870))
([956ac4d](956ac4d))


### Bug Fixes

* **bigquery-jdbc:** preserve civil digits for DATETIME/DATE
([#14910](#14910))
([53bbde0](53bbde0))
* **bigquery:** handle empty queryParameters list in ConnectionImpl
([#14917](#14917))
([cfea223](cfea223))
* **bigtable:** allow non-default service accounts for session
DirectAccess
([#14926](#14926))
([9f4a76a](9f4a76a))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Neenu1995 Neenu1995 Neenu1995 approved these changes
@logachev logachev Awaiting requested review from logachev
+1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@keshavdandeva @Neenu1995
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.