-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(bigquery): transition format options #13422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR is minimal, and updates all callsites that use the older UseInt64Timestamp boolean for controlling output to instead use the newer TimestampOutputFormat option and specify it using INT64. Followup PRs will update this to use the new ISO string for output.
Summary of ChangesHello @shollyman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the BigQuery client library by transitioning its timestamp output formatting mechanism. It replaces the older boolean flag Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
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 correctly transitions from the deprecated UseInt64Timestamp boolean to the TimestampOutputFormat option for BigQuery calls, setting it to "INT64". The changes are applied consistently across all relevant call sites and tests. My main feedback is to define the string "INT64" as a constant to avoid magic strings and improve maintainability. This is particularly relevant as a follow-up PR is planned to change this value, and using a constant would make that change safer and more explicit. I've left comments on each occurrence.
| } | ||
| call := src.t.c.bqs.Tabledata.List(src.t.ProjectID, src.t.DatasetID, src.t.TableID) | ||
| call = call.FormatOptionsUseInt64Timestamp(true) | ||
| call = call.FormatOptionsTimestampOutputFormat("INT64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve maintainability and avoid using a "magic string", consider defining "INT64" as a constant. This string appears in multiple files in this PR. Creating a constant, for example const timestampOutputFormatInt64 = "INT64", in a suitable shared location would make the code more readable and easier to update. The PR description mentions a future change to an ISO string format, which would be simpler and safer to implement with a constant.
| projectedFields := []googleapi.Field{"rows", "pageToken", "totalRows"} | ||
| call := src.j.c.bqs.Jobs.GetQueryResults(src.j.projectID, src.j.jobID).Location(src.j.location).Context(ctx) | ||
| call = call.FormatOptionsUseInt64Timestamp(true) | ||
| call = call.FormatOptionsTimestampOutputFormat("INT64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Use GetQueryResults only to wait for completion, not to read results. | ||
| call := j.c.bqs.Jobs.GetQueryResults(projectID, j.jobID).Location(j.location).Context(ctx).MaxResults(0) | ||
| call = call.FormatOptionsUseInt64Timestamp(true) | ||
| call = call.FormatOptionsTimestampOutputFormat("INT64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Labels: q.Labels, | ||
| FormatOptions: &bq.DataFormatOptions{ | ||
| UseInt64Timestamp: true, | ||
| TimestampOutputFormat: "INT64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| UseLegacySql: &pfalse, | ||
| FormatOptions: &bq.DataFormatOptions{ | ||
| UseInt64Timestamp: true, | ||
| TimestampOutputFormat: "INT64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| UseQueryCache: &pfalse, | ||
| FormatOptions: &bq.DataFormatOptions{ | ||
| UseInt64Timestamp: true, | ||
| TimestampOutputFormat: "INT64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is minimal, and updates all callsites that use the older UseInt64Timestamp boolean for controlling output to instead use the newer TimestampOutputFormat option and specify it using INT64.
Followup PRs will update this to use the new ISO string for output.
Towards internal b/447623020