feat(bigquery/storage/managedwriter): allow overriding proto conversion mapping #12579
Merged
Conversation
… proto description conversion
shollyman
reviewed
Jul 17, 2025
|
|
||
| // WithTimestampWellKnownType defines that table fields of type Timestamp, are mapped | ||
| // as Google's WKT timestamppb.Timestamp. | ||
| func WithTimestampWellKnownType(useTimestampWellKnownType bool) Option { |
Contributor
There was a problem hiding this comment.
Do we want this to be option more configurable? for a given input schema type, should the user be able to specify the desired output proto type? Almost all of the schema types in https://cloud.google.com/bigquery/docs/supported-data-types list multiple possible proto representations.
Contributor
Author
There was a problem hiding this comment.
excellent point, I'll see how to make it more configurable.
shollyman
reviewed
Aug 18, 2025
shollyman
approved these changes
Aug 21, 2025
This was referenced Aug 27, 2025
This was referenced Sep 3, 2025
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.
Currently the usage of
bigquery.InferSchemaandadapt. StorageSchemaToProto2Descriptormethods to generate proto descriptors with tables that have fields of typeTIMESTAMPcan have compatibility issues, since the original struct has atime.Timefield and in the proto descriptor it becomes anINT64.This PR adds an option to convert to Google's Timestamp Well Known Type (WKT), which is also accepted by the Storage Write API. I think we can't make it the default because some customer might be relying on unmarshalling JSON data with timestamps in the
INT64format ( unix timestamp ) instead of a RFC3339 formatted timestamp string already.Also we discussed adding options to the
StorageSchemaToProto2Descriptormethod before, on the improvement issue related to CDC helpers: #10721Naming is hard, but not sure what is the best name for the
WithTimestampWellKnownTypemethod. Open to suggestions.Fixes #12569
Supersedes #12578