Skip to content
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

fix(bigquery/storage/managedwriter/adapt): schema->protodescriptor #6267

Merged
merged 2 commits into from Jun 29, 2022

Conversation

shollyman
Copy link
Contributor

@shollyman shollyman commented Jun 27, 2022

This PR addresses a transitive dependency loss when working with nested
messages. Previously, we only constructed a descriptor using the direct
dependencies, and this changes the implementation to use the cache of
all encountered descriptors rather than the local list of dependencies.

There's still some opportunities for improvement with regards to
proto3, in particular the wrapper types. However, I'm deferring that
until we have that sorted out in the backend a bit better.

This also changes the testing slightly. I've added a comment to the
test as well, but our problem is evaluating the dependencies for
correctness. Due to the dynamic nature of how descriptors are created
we cannot use something like proto.Equal.

To address this, we make two comparisons. In the first, we check the
descriptor directly without its dependencies. In the second, we
call the normalizer to give us a self-contained descriptor proto, where
we can validate everything is present. The gap here of course is that
a bug in the normalizer may mask a problem with the conversion, so
consideration is warranted when we revisit this.

Fixes: #6258

This PR addresses a transitive dependency loss when working with nested
messages.  Previously, we only constructed a descriptor using the direct
dependencies, and this changes the implementation to use the cache of
all encountered descriptors rather than the local list of dependencies.

There's still some opportunities for improvement with regards to
proto3, in particular the wrapper types.  However, I'm deferring that
until we have that sorted out in the backend a bit better.

This also changes the testing slightly.  I've added a comment to the
test as well, but our problem is evaluating the dependencies for
correctness.  Due to the dynamic nature of how descriptors are created
we can use something like proto.Equal.

To address this, we make two comparisons.  In the first, we check the
descriptor directly without its dependencies.  In the second, we
call the normalizer to give us a self-contained descriptor proto, where
we can validate everything is present.  The gap here of course is that
a bug in the normalizer may mask a problem with the conversion, so
consideration is warranted when we revisit this.

Fixes: googleapis#6258
@shollyman shollyman requested a review from a team June 27, 2022 23:06
@shollyman shollyman requested a review from a team as a code owner June 27, 2022 23:06
@shollyman shollyman requested a review from prash-mi June 27, 2022 23:06
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the BigQuery API. labels Jun 27, 2022
@shollyman shollyman requested review from steffnay and removed request for prash-mi June 27, 2022 23:09
@shollyman shollyman enabled auto-merge (squash) June 29, 2022 19:45
@shollyman shollyman disabled auto-merge June 29, 2022 19:45
@shollyman shollyman enabled auto-merge (squash) June 29, 2022 19:45
@shollyman shollyman merged commit a017230 into googleapis:main Jun 29, 2022
@shollyman shollyman deleted the issue6258-adapt branch June 29, 2022 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bigquery/storage: StorageSchemaToProtoXDescriptor fails on nested proto messages
2 participants