Skip to content

impl(bigquery): convert STRUCT to nested protos - #7463

Open
haphungw wants to merge 1 commit into
googleapis:mainfrom
haphungw:bq-json-pr04-struct-columns
Open

haphungw wants to merge 1 commit into
googleapis:mainfrom
haphungw:bq-json-pr04-struct-columns

Conversation

@haphungw

@haphungw haphungw commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Convert BigQuery STRUCT columns into nested DescriptorProto messages in root.nested_type.

In BigQuery, a STRUCT column stores its subfields inline on TableFieldSchema.fields. In protobuf, a FieldDescriptorProto can't hold subfields inline: instead, the field sets type = TYPE_MESSAGE and type_name = "m1", and root.nested_type holds the DescriptorProto named "m1" with those subfields.

For (id INT64, address STRUCT<city STRING>), this produces the equivalent of:

message root {
  optional int64 id = 1;
  optional m1 address = 2;
  message m1 {
    optional string city = 1;
  }
}

Towards #6783

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the BigQuery API. label Nov 13, 2026

@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 implements support for converting BigQuery STRUCT columns into nested Protobuf messages. It introduces recursive descriptor generation, handles nested error path propagation (e.g., a.b), avoids naming collisions with sibling columns, and adds comprehensive unit tests to validate these behaviors. I have no feedback to provide as the implementation is clean, robust, and conforms to the repository style guidelines.

@haphungw
haphungw marked this pull request as ready for review November 13, 2026 21:46
@haphungw
haphungw requested a review from a team as a code owner November 13, 2026 21:46
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.60%. Comparing base (bb112d0) to head (13ca964).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7463   +/-   ##
=======================================
  Coverage   98.60%   98.60%           
=======================================
  Files         338      338           
  Lines      148237   148319   +82     
=======================================
+ Hits       146172   146253   +81     
- Misses       2065     2066    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haphungw
haphungw marked this pull request as draft November 13, 2026 22:10
@haphungw
haphungw force-pushed the bq-json-pr04-struct-columns branch from 137bfed to 13ca964 Compare November 14, 2026 02:01
@haphungw
haphungw marked this pull request as ready for review November 14, 2026 02:04

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

api: bigquery Issues related to the BigQuery API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant