Skip to content

fix(bigquerystorage): disambiguate nested proto type names - #15461

Draft
pratt4 wants to merge 2 commits into
googleapis:mainfrom
pratt4:oss/google-cloud-java-15068-struct-type-collisions
Draft

pratt4 wants to merge 2 commits into
googleapis:mainfrom
pratt4:oss/google-cloud-java-15068-struct-type-collisions

Conversation

@pratt4

@pratt4 pratt4 commented Dec 6, 2026

Copy link
Copy Markdown

Fixes #15068.

Give incompatible nested Protobuf message layouts distinct names when BigQuery field paths such as a__b and a.b collapse to the same generated name. Continue to reuse compatible layouts. This preserves both columns and prevents the write schema from silently decoding a value under the other column’s field names.

In the local writer regression, a nested row intended to hold p=4, q=3 was decoded as p=3, q=4 on the baseline. The reviewed patch preserved p=4, q=3. The 77 affected tests passed, and protobuf-java and protoc both accepted the descriptors from three additional writer fixtures. Final full-module and cloud integration checks are pending.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates BQTableSchemaToProtoDescriptor to prevent naming collisions when converting BigQuery table schemas to Proto descriptors by tracking used names and appending suffixes to colliding nested message names. It also adds comprehensive tests to verify correct handling of colliding struct, range, and placeholder names. The reviewer suggested using Locale.ROOT when calling toLowerCase() on field names to prevent locale-dependent bugs.

…a/com/google/cloud/bigquery/storage/v1/BQTableSchemaToProtoDescriptor.java

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant