Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the getBooleanValue method in FieldValue.java to explicitly validate and parse boolean strings ("true" and "false" case-insensitively) and throw an IllegalStateException for invalid inputs, replacing the previous usage of Guava's checkState and Boolean.parseBoolean. Additionally, corresponding unit tests have been added in FieldValueTest.java to verify this behavior. There are no review comments, and I have no feedback to provide.
lqiu96
enabled auto-merge (squash)
November 13, 2026 22:10
This branch has not been deployed
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
Simplifies
FieldValue.getBooleanValue()to check"true"and"false"once while preserving the existingIllegalStateExceptioncontract.Previously,
getBooleanValue()validated both literals withPreconditions.checkState(stringValue.equalsIgnoreCase("true") || stringValue.equalsIgnoreCase("false"), ...)and then calledBoolean.parseBoolean(stringValue)(which performs"true".equalsIgnoreCase(stringValue)a second time, sinceBoolean.parseBooleanon its own would returnfalsefor invalid strings).Changes
FieldValue:"true".equalsIgnoreCase(stringValue)and"false".equalsIgnoreCase(stringValue)directly ingetBooleanValue()and throwIllegalStateExceptionif neither matches.Boolean.parseBoolean.Preconditions.checkStateimport.FieldValueTest:testGetBooleanValuecovering"true","false", mixed case, and invalid strings throwingIllegalStateException.Verification
mvn test -pl java-bigquery/google-cloud-bigquery -Dtest=FieldValueTest(7 passed)mvn test -pl java-bigquery/google-cloud-bigquery -Dtest=FieldValueListTest(5 passed)