Skip to content

fix(bigquery): support optional fields in BigLakeConfiguration to prevent NPE on Iceberg/Lakehouse tables#13733

Open
keshavdandeva wants to merge 4 commits into
mainfrom
bq-fix-npe-on-pcnt-tables
Open

fix(bigquery): support optional fields in BigLakeConfiguration to prevent NPE on Iceberg/Lakehouse tables#13733
keshavdandeva wants to merge 4 commits into
mainfrom
bq-fix-npe-on-pcnt-tables

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

b/534291682

This PR resolves a NullPointerException encountered when querying or retrieving metadata for 4-part PCNT (Project.Catalog.Namespace.Table) Apache Iceberg tables governed by external REST catalogs.

Changes

  • Annotated all 4 fields (connectionId, fileFormat, storageUri, tableFormat) and their corresponding setters in @AutoValue.Builder with @Nullable in BigLakeConfiguration.java.
  • Cleaned up the Javadoc comments for the builder setters in BigLakeConfiguration.java to remove incorrect [Required] notations and updated getTableFormat() Javadoc to reflect the correct table format reference (e.g., Iceberg) instead of file format.
  • Added unit test coverage to BigLakeConfigurationTest.java (testNullFields, testFromPbWithNullFields) to verify that constructing the configuration or mapping it from API models works successfully when properties are null.

@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 BigLakeConfiguration to allow nullable fields, adding @Nullable annotations to the getters and builder setters, and removing the "[Required]" designation from the builder's Javadocs. It also adds unit tests to verify behavior when fields are null. The review feedback identifies copy-paste errors in the Javadocs for getTableFormat() and setTableFormat(), which incorrectly refer to "file format" and "PARQUET" instead of "table format" and "ICEBERG".

@keshavdandeva

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 BigLakeConfiguration by adding @Nullable annotations to its getters and builder setters, updating Javadoc comments, and adding unit tests to verify null field handling. The feedback suggests using the more idiomatic assertNull(value) instead of assertEquals(null, value) in the new test cases.

@keshavdandeva
keshavdandeva marked this pull request as ready for review July 13, 2026 15:13
@keshavdandeva
keshavdandeva requested review from a team as code owners July 13, 2026 15:13
@keshavdandeva
keshavdandeva requested review from logachev and lqiu96 July 13, 2026 15:13
*
* @return value or {@code null} for none
*/
@Nullable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are actually trying to migrate to use JSpecify (timeline for full migration in handwritten libraries is not set). Is it possible to use the JSpecify nullable annotations instead of javax (atleast for new annotations)?

/**
* [Required] Required and immutable. Credential reference for accessing external storage
* system. Normalized as project_id.location_id.connection_id.
* Immutable. Credential reference for accessing external storage system. Normalized as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: What does immutable mean in this case (on a setter)? do you think we can just remove it as it would be implied to not be changing when the class is built?

@lqiu96 lqiu96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you see if we can use JSpecify annotations? If there is some issue with autovalue integration, javax is fine for now as well

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants