Skip to content

fix(bigquery-jdbc): format RANGE bounds consistently across REST and Arrow - #14807

Merged
keshavdandeva merged 4 commits into
mainfrom
jdbc/fix-range-timestamp-format
Oct 28, 2026
Merged

keshavdandeva merged 4 commits into
mainfrom
jdbc/fix-range-timestamp-format

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

b/570670164

Summary

RANGE values were formatted inconsistently depending on element type and read path:

  • REST RANGE<TIMESTAMP> returned raw epoch seconds: [1767225600.000000, 1798761599.000000)
  • REST RANGE<DATETIME> used a T separator: [2026-01-01T00:00:00, ...)
  • Arrow formatted both differently from REST
  • Arrow STRUCT<RANGE> returned a raw map: {"start":...,"end":...}

Fix

Added a single BigQueryTemporalUtility.formatRange used by all REST and Arrow read paths (top-level, ARRAY, STRUCT). Each bound now reads exactly like getString on its element type:

Element Output
DATE [2026-01-01, 2026-12-31)
DATETIME [2026-01-01 00:00:00.000000, 2026-12-31 23:59:59.000000)
TIMESTAMP (UTC) [2026-01-01 00:00:00.000000, 2026-12-31 23:59:59.000000)

UNBOUNDED is kept for open bounds. EnableTimestampPicos now only controls TIMESTAMP fraction digits (6 vs 12) instead of gating formatting altogether.

Behaviour change

REST callers parsing the old epoch / T-separated strings will see the new format.

Testing

  • Unit: formatter coverage for REST and Arrow inputs; RANGE inside STRUCT and ARRAY for both paths.
  • IT: updated testRangeDataTypeWithJsonResultSet; added testRangeBoundsFormatIdenticallyOnRestAndArrow (REST vs. Arrow parity).

@keshavdandeva
keshavdandeva requested review from a team as code owners October 28, 2026 12:27

@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 refactors the formatting of RANGE data types across the BigQuery JDBC driver by consolidating duplicate formatting logic from various result set and struct classes into a centralized utility method, BigQueryTemporalUtility.formatRange. Feedback on these changes includes a recommendation to check if a FieldValue is null before retrieving its range value to prevent potential exceptions, as well as a suggestion to remove redundant case normalization when parsing range element types.

@Neenu1995

Copy link
Copy Markdown
Contributor

LGTM, but there may be some dead code to clean up in TypeRegistry.

@keshavdandeva
keshavdandeva force-pushed the jdbc/fix-range-timestamp-format branch from aecbe3d to 51763c3 Compare October 28, 2026 18:09
@keshavdandeva
keshavdandeva enabled auto-merge (squash) October 28, 2026 18:10
@keshavdandeva
keshavdandeva merged commit 2108b8e into main Oct 28, 2026
199 checks passed
@keshavdandeva
keshavdandeva deleted the jdbc/fix-range-timestamp-format branch October 28, 2026 18:22
jinseopkim0 pushed a commit that referenced this pull request Nov 3, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>1.95.0</summary>

##
[1.95.0](v1.94.0...v1.95.0)
(2026-11-02)


### Features

* **bigquery-jdbc:** expose BigQueryResultSetMetadata and getField(int)
([#14761](#14761))
([f01245a](f01245a))
* **gax:** align resumable upload chunk size to server granularity and
surface effective chunk size
([#14670](#14670))
([6cbb096](6cbb096))
* **google/cloud/designcenter/v1:** add designcenter
([#14823](#14823))
([01d27dc](01d27dc))
* **google/cloud/observability/v1:** add observability
([#14722](#14722))
([624f28e](624f28e))
* **oauth2:** support certificate-bound OAuth2 tokens and mTLS rotation
for Workload Identity Federation
([#14781](#14781))
([dcb29b0](dcb29b0))
* **storage:** add bucket IP filtering samples and tests
([#14328](#14328))
([cb2b726](cb2b726))
* **storage:** add support for DirectPath over Interconnect
([#14006](#14006))
([ad0eb94](ad0eb94))
* **storage:** OpenTelemetry client metrics configuration and options
([#14484](#14484))
([7c29e48](7c29e48))
* **storage:** OpenTelemetry client metrics instrument registry and
views
([#14398](#14398))
([60233b7](60233b7))


### Bug Fixes

* add user agent to session path
([#14835](#14835))
([a653638](a653638))
* **auth:** align mTLS transport and bound token certificate startup
polling and well-known discovery
([#14748](#14748))
([0bae268](0bae268))
* **bigquery-jdbc:** expand handling to OOM errors
([#14759](#14759))
([7d4b921](7d4b921))
* **bigquery-jdbc:** fix naive fallback of parameter count
([#14779](#14779))
([c3e4a5b](c3e4a5b))
* **bigquery-jdbc:** format RANGE bounds consistently across REST and
Arrow
([#14807](#14807))
([2108b8e](2108b8e))
* **bigquery-jdbc:** parse scientific-notation epoch TIMESTAMPs
([#14777](#14777))
([71a31b1](71a31b1))
* **bigquery-jdbc:** preserve pre-1582 and pre-standard-time
DATE/DATETIME digits
([#14787](#14787))
([3dc394f](3dc394f))
* **bigtable:** avoid mutating Query in-place in createPointReadCallable
([#14797](#14797))
([1b1c6a7](1b1c6a7))
* **bigtable:** check isOk and getRejected first in
RetryingVRpc.shouldRetry
([#14795](#14795))
([d821bd3](d821bd3))
* **bigtable:** check remaining deadline on client-initiated retries in
RetryingVRpc
([#14796](#14796))
([a04e24c](a04e24c))
* **bigtable:** Fix empty RowResult semantics in TestProxy.
([#14810](#14810))
([1d2fb9a](1d2fb9a))
* **bigtable:** include reversed in Query equals, hashCode, and toString
([#14799](#14799))
([fe9232b](fe9232b))
* **bigtable:** pass cell value size to RowBuilder.startCell in
RowBuilderShim
([#14800](#14800))
([cfa7949](cfa7949))
* **bigtable:** reject empty split points in RowSetUtil and clarify
QueryPaginator Javadoc
([#14811](#14811))
([1bc507f](1bc507f))
* **bigtable:** remove legacy PollingConfiguration migration in
ClientConfigurationManager
([#14822](#14822))
([95ead45](95ead45))
* **bigtable:** resolve session diversion through a single shared rule
([#14738](#14738))
([00f7bea](00f7bea))
* **bigtable:** respect query limit smaller than pageSize and avoid
mutating Query in QueryPaginator
([#14821](#14821))
([cecd09e](cecd09e))
* **firestore:** graduate pipeline search from preview to GA
([#14741](#14741))
([a993026](a993026))
* **gax:** do not treat a SocketTimeoutException as a thread interrupt
([#14778](#14778))
([7b91805](7b91805))
* **jdbc:** populate `ResultSetMetaData` on empty `DatabaseMetaData`
resultsets
([#14809](#14809))
([4c6a7e3](4c6a7e3))
* **pubsub:** make publish hedging robust to clock jumps, queue errors,
and shutdown
([#14860](#14860))
([9b9e2a5](9b9e2a5))
* **spanner:** attach routing hints to read-write transaction requests
([#14786](#14786))
([54e0585](54e0585))
* **spanner:** cancel queries promptly on close and synchronize error
handling
([#14887](#14887))
([323a8f7](323a8f7))
* **spanner:** do not cache retryable errors in AbstractLazyInitializer
([#14752](#14752))
([6a9ac76](6a9ac76))
* **spanner:** restore setCall overload for stream test compatibility
([#14885](#14885))
([cfe728e](cfe728e))
* **spanner:** synchronize stream lifecycle and retry buffering in
ResumableStreamIterator
([#14770](#14770))
([4edefc5](4edefc5))
* **spanner:** trigger best-effort rollback on indeterminate commit
failures
([#14831](#14831))
([b9d1b95](b9d1b95))
* **storage:** preserve HTTP status for XML multipart upload errors so
retries work
([#14804](#14804))
([3c03034](3c03034))
* **storage:** send destination on gRPC copy when target BlobInfo is
provided
([#14784](#14784))
([43a67a0](43a67a0))
* **storage:** validate CRC32C on HTTP downloads that were not
decompressed
([#14805](#14805))
([61aa22f](61aa22f))


### Documentation

* **bigtable:** document that skipped large rows count towards row limit
([#14801](#14801))
([91d60e0](91d60e0))
</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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants