Skip to content

test(bigquery-jdbc): add picosecond timestamp integration tests - #14392

Open
keshavdandeva wants to merge 2 commits into
jdbc-picosecond-support-6from
jdbc-picosecond-support-7
Open

keshavdandeva wants to merge 2 commits into
jdbc-picosecond-support-6from
jdbc-picosecond-support-7

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

b/556664087

This PR adds ITs and and fixes one gap the ITs uncovered.

Production fix

BigQueryConnection.getBigQueryConnection() now sets
DataFormatOptions.TimestampFormatOptions.ISO8601_STRING when
EnableTimestampPicos=1.

The REST JSON read path was silently truncating to microseconds. BigQuery
serializes TIMESTAMP as FLOAT64 epoch seconds by default, which cannot
represent sub-microsecond digits; ISO8601_STRING is the only output format
that carries the full 12-digit fraction. The Arrow path was already correct,
which is why unit tests and metadata assertions passed while REST values did
not.

Gated on the property so the wire format is unchanged for existing users.

Tests

New ITJdbcTimestampPicosTest (11 tests): Arrow and REST read paths, complex
types (ARRAY/STRUCT), ResultSetMetaData, DatabaseMetaData.getColumns,
PreparedStatement round trips, Legacy SQL rejection, and timezone
invariance.

Registered in the presubmit, nightly, and driver-agnostic suites. Six tests
carry @Tag("advanced") where behavior is driver-specific; the remaining five
were verified to pass against other drivers.

Known limitation

BigQuery truncates TIMESTAMP-typed query parameters to microseconds even
against a TIMESTAMP(12) column (b/419328655), so setTimestamp/setObject
cannot write picosecond values. setString works, since the value is coerced
server side. Documented in USER_GUIDE.md and asserted in the tests so the
expectations flip loudly when the backend fix lands.

@keshavdandeva
keshavdandeva added this pull request to stack #14393 September 15, 2026 19:25

@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 adds support for 12-digit picosecond precision for TIMESTAMP(12) data types in the BigQuery JDBC driver when EnableTimestampPicos is enabled, configuring DataFormatOptions to use ISO8601_STRING serialization. The changes include documentation updates, unit tests, and comprehensive integration tests. The reviewer suggested using a UUID-based suffix instead of a random integer for test table names to prevent potential collisions in concurrent CI/CD pipelines.

@keshavdandeva
keshavdandeva marked this pull request as ready for review September 15, 2026 19:29
@keshavdandeva
keshavdandeva requested review from a team as code owners September 15, 2026 19:29
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.

1 participant