Repository navigation
fix(bigquery): [T1-4] propagate useInt64Timestamp to listTableData/getQueryResults and optimize FieldValue.getTimestampValue - #9
Open
lqiu96 wants to merge 1 commit into
Conversation
lqiu96
force-pushed
the
perf/bq-t1-04-timestamp-parsing-and-option
branch
5 times, most recently
from
October 13, 2026 22:01
3e08f71 to
4fd8299
Compare
…esults and FieldValue
lqiu96
force-pushed
the
perf/bq-t1-04-timestamp-parsing-and-option
branch
from
October 13, 2026 22:07
4fd8299 to
e7fccb2
Compare
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.
Summary & Bottleneck
QueryRequestInfo.toPb()configuresformatOptions.useInt64Timestampon fast-pathjobs.queryRPCs whenDataFormatOptions.useInt64Timestamp(true)is enabled. However,HttpBigQueryRpcnever setsformatOptions.useInt64Timestampontabledata.list(listTableDataSkipExceptionTranslationandlistTableDataWithRowLimitSkipExceptionTranslation) orjobs.getQueryResults(getQueryResultsSkipExceptionTranslationandgetQueryResultsWithRowLimitSkipExceptionTranslation).BigQueryImpl.listTableDatapassesserviceOptions.getDataFormatOptions().useInt64Timestamp()intoFieldValueList.fromPb, any call tolistTableDataor Page 2+ query pagination withuseInt64Timestamp(true)receives floating-point seconds in scientific notation from the backend whileFieldValue.getTimestampValue()attempts to parse an integer microsecond string, throwingNumberFormatException.FieldValue.getTimestampValue()allocates aBigIntegeron every cell whenuseInt64Timestampsistrue, and allocates threeBigDecimalobjects per cell (new BigDecimal,scaleByPowerOfTen(6), andsetScale(0, RoundingMode.HALF_UP)) whenuseInt64Timestampsisfalse. This scales asChanges
.setFormatOptionsUseInt64Timestamp(...)fromthis.options.getDataFormatOptions().useInt64Timestamp()inlistTableDataSkipExceptionTranslation,listTableDataWithRowLimitSkipExceptionTranslation,getQueryResultsSkipExceptionTranslation, andgetQueryResultsWithRowLimitSkipExceptionTranslationinjava-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java.Long.parseLong(stringValue)(withBigIntegerfallback) whenuseInt64Timestampsistrueinjava-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java.parseDecimalSecondsToMicros) injava-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.javafor standard[-]seconds[.fraction]strings withHALF_UProunding at the microsecond digit, falling back toBigDecimalonly for scientific notation or >12-digit integer seconds.java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.javaandjava-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpcTest.java.Expected Impact
NumberFormatExceptiononlistTableDataand multi-page query pagination whenDataFormatOptions.useInt64Timestamp(true)is enabled.BigInteger+int[]allocation per timestamp cell whenuseInt64Timestampsistrue, and eliminates 3BigDecimalallocations per standard decimal timestamp cell whenuseInt64Timestampsisfalse($O(\text{rows} \times \text{timestamp_cols})$).Verification
FieldValueTest,HttpBigQueryRpcTest, andBigQueryImplTestvia Maven (239tests run,0failures).