Repository navigation
fix(bigquery): apply DataFormatOptions to tabledata.list requests - #14889
Open
keshavdandeva wants to merge 2 commits into
Open
keshavdandeva wants to merge 2 commits into
keshavdandeva wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the BigQuery client to support and propagate DataFormatOptions (specifically TimestampFormatOptions) when listing table data. It modifies BigQueryImpl to pass the full DataFormatOptions object and updates HttpBigQueryRpc to set these format options on the underlying API request. Additionally, integration and unit tests are updated to cover these changes. A potential NullPointerException was identified in HttpBigQueryRpc.java when calling toString() on a potentially null timestampFormat object, which should be resolved by adding a null check.
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/579291912
BigQueryOptions.setDataFormatOptions(...)is only sent onjobs.query. Rows read throughtabledata.listdon't get it, so BigQuery returns TIMESTAMPs as float64 there while the client decodes them using the configured format.tabledata.listserves:listTableData/Table.listquery()Job.getQueryResults()Impact:
useInt64Timestamp(true):getTimestampValue()/getTimestampInstant()throwNumberFormatException.timestampFormatOptions(INT64): values are decoded as seconds, so dates come out wrong. This also happens on page 1.ISO8601_STRING: rows fromtabledata.listcome back as float64.9999-12-31 23:59:59.999999becomes+10000-01-01.Changes
HttpBigQueryRpc:listTableDatasendsformatOptions.useInt64Timestamp/formatOptions.timestampOutputFormat, only when they differ from the defaults. Default requests are unchanged.BigQueryImpl: rows are decoded as int64 when eitheruseInt64Timestamp(true)ortimestampFormatOptions(INT64)is set.No public API changes.
Tests
HttpBigQueryRpcTest: defaults send noformatOptions, and configured options are sent.BigQueryImplTest:INT64values fromlistTableDatadecode as int64.ITBigQueryTest#testLosslessMaxTimestampIntegration: now reads 2 pages (the second viatabledata.list) and adds anINT64case.All new and changed tests fail without the fix and pass with it.