Repository navigation
Conversation
lqiu96
force-pushed
the
fix/bq-b5-domain-model-bugs
branch
2 times, most recently
from
October 13, 2026 15:59
987e603 to
fc42699
Compare
lqiu96
force-pushed
the
fix/bq-b5-domain-model-bugs
branch
from
October 13, 2026 17:16
fc42699 to
aab8131
Compare
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.
Summary & Bottleneck
Several domain model classes in
google-cloud-bigquerycontain self-assignment, wrong-getter, and switch fall-through bugs discovered during the codebase audit:IndexUnusedReason.toPb()self-assignment:java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/IndexUnusedReason.java,toPb()callsindexUnusedReason.setIndexName(indexUnusedReason.getIndexName()),indexUnusedReason.setCode(indexUnusedReason.getCode()), andindexUnusedReason.setMessage(indexUnusedReason.getMessage())on the newly allocated empty protobuf instance instead of readinggetIndexName(),getCode(), andgetMessage()fromthis.JobStatistics.Builder(JobStatistics)uninitialized field check:java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java,Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb)checksif (reservationUsage != null)(which is alwaysnullon a newly constructedBuilder) instead ofif (statisticsPb.getReservationUsage() != null), causinggetReservationUsage()to always returnnullafterfromPb.ExternalTableDefinition.fromExternalDataConfigurationwrong getter:java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java,fromExternalDataConfigurationcallsbuilder.setTimestampFormat(externalDataConfiguration.getTimeFormat())instead ofexternalDataConfiguration.getTimestampFormat().QueryParameterValueduplicateString.classbranches andcase JSON:fall-through:java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java,classToTypecontains two unreachable duplicateelse if (String.class.isAssignableFrom(type))branches, andvalueToStringOrNullis missing abreakstatement at the end ofcase JSON:, allowing non-JSONPeriodDurationvalues to fall through intocase INTERVAL:.Changes
java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/IndexUnusedReason.java:getIndexName(),getCode(), andgetMessage()to the protobuf setters intoPb().java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java:if (statisticsPb.getReservationUsage() != null)inJobStatistics.Builder(statisticsPb).java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java:externalDataConfiguration.getTimestampFormat()tobuilder.setTimestampFormat(...)infromExternalDataConfiguration.java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java:String.classbranches inclassToTypeand add the missingbreakstatement incase JSON:ofvalueToStringOrNull.Expected Impact
toPb()andfromPb()round-trip serialization forIndexUnusedReason,JobStatistics.getReservationUsage(), andExternalTableDefinition.getTimestampFormat().PeriodDurationvalues from being silently accepted when constructingStandardSQLTypeName.JSONquery parameters.Verification
java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java,ExternalTableDefinitionTest.java, andQueryParameterValueTest.java.mvn test -pl java-bigquery/google-cloud-bigquery -Dtest=JobStatisticsTest,ExternalTableDefinitionTest,QueryParameterValueTest(51 tests run, 0 failures).