Skip to content

fix(bigquery-jdbc): format TIMESTAMP as UTC in getString and add multi-zone TIMESTAMP(12) tests - #14666

Open
keshavdandeva wants to merge 1 commit into
mainfrom
jdbc/fix-getstring-timestamp-utc
Open

keshavdandeva wants to merge 1 commit into
mainfrom
jdbc/fix-getstring-timestamp-utc

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

b/563395776
b/565818888

Summary

  • Formats TIMESTAMP values in UTC (ZoneOffset.UTC) when calling ResultSet.getString() or ResultSet.getObject(..., String.class) across scalar, ARRAY<TIMESTAMP>, and STRUCT<TIMESTAMP> columns, while preserving local wall-clock digits for DATETIME.
  • Fixes BigQueryBaseResultSet.getStandardSQLTypeName() to return StandardSQLTypeName.ARRAY for repeated fields so getObject(int, Class<T>) does not treat ARRAY<TIMESTAMP> columns as scalar TIMESTAMP.
  • Adds multi-timezone unit and integration tests for getString and TIMESTAMP(12) temporal accessors across both REST JSON and Storage Read API (Arrow) result sets.

Testing

  • Added multi-timezone unit tests in BigQueryJsonResultSetTest and BigQueryArrowResultSetTest.
  • Enabled testGetString_returnsUtcDigits and testRoundTrip_getStringThenSetString in ITTimestampTimeZoneTest.
  • Parameterized testTemporalAccessors_picosEnabled_truncateToJavaPrecision in ITJdbcTimestampPicosTest across JVM timezones and both JSON/Arrow read paths.

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

Copy link
Copy Markdown
Contributor

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 updates the BigQuery JDBC driver to consistently format and return TIMESTAMP values as UTC strings instead of relying on the JVM's default time zone. Key changes include adding UTC timestamp formatting utility methods in BigQueryTemporalUtility, updating BigQueryBaseArray and BigQueryBaseStruct to format timestamps to UTC in their toString() methods, and optimizing BigQueryTypeRegistry to handle String.class conversions directly. Additionally, various integration and unit tests have been added or updated to verify timezone-independent timestamp behavior across different JVM zones. There are no review comments to address, and the changes look solid.

@keshavdandeva
keshavdandeva marked this pull request as ready for review October 16, 2026 14:39
@keshavdandeva
keshavdandeva requested review from a team as code owners October 16, 2026 14:39

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants