Repository navigation
fix(bigquery-jdbc): parse scientific-notation epoch TIMESTAMPs - #14777
Open
keshavdandeva wants to merge 1 commit into
Open
keshavdandeva wants to merge 1 commit into
keshavdandeva wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates BigQueryTemporalUtility.boxTimestamp to correctly parse epoch decimals in scientific notation (e.g., "1.0E-6"), which are used by the JSON/REST API for timestamps close to the epoch. It also adds comprehensive unit and integration tests to verify this behavior. The review feedback highlights a potential performance issue where DATE strings (which lack colons) will trigger a caught NumberFormatException in a hot path, and provides a code suggestion to optimize this check by ensuring hyphens are only allowed at the start or when preceded by 'E' or 'e'.
Neenu1995
approved these changes
Oct 26, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
b/570670063
Summary
Reading a
TIMESTAMPwithin 1 ms of the Unix epoch (excluding exactly 0) over the REST API threwBigQueryConversionExceptionfromgetString,getTimestampandgetObject.Root cause
The REST API sends these values in scientific notation (
1.0E-6,-1.0E-4).BigQueryTemporalUtility.boxTimestampused'-'to tell epoch decimals from ISO strings, so a negative exponent sent the value down the ISO path, whereTimestamp.valueOfthrew.Fix
Treat a value as an epoch decimal when it has no
':'. Every ISO/civil timestamp has one and no epoch decimal does. This is the same checkformatTimestampValuealready uses.This also fixes
TIMESTAMPvalues insideSTRUCT/ARRAYon the REST path, which go through the same method. Arrow was not affected: it sends TIMESTAMP asLongmicros.Tests
BigQueryTemporalUtilityTest#testBoxTimestamp: added1.0E-6,9.99E-4,-1.0E-6,-1.0E-4.ITTimestampTimeZoneTest: added ±1 µs columns to the shared query and asserted them intestGetString_returnsUtcDigitsandtestGetTimestampAndGetObject_returnMoment, across 4 JVM zones.