-
Notifications
You must be signed in to change notification settings - Fork 389
Description
version: v2-rev20230408-2.0.0
Description
The numTotalLogicalBytes field of com.google.api.services.bigquery.model.Table class has an incorrect @Key annotation.
In its current state the annotation value is num_total_logical_bytes.
There's no need for the value in the @Key("<placeholder value>") annotation, just @Key is enough since the json field and the java field have the exact same name.
Lines 260 to 261 in 09b3ea5
| @com.google.api.client.util.Key("num_total_logical_bytes") @com.google.api.client.json.JsonString | |
| private java.lang.Long numTotalLogicalBytes; |
How did we found the bug?
We recently filed the following PR googleapis/java-bigquery#2673 that exposes the above field along with similar storage information in java-bigquery client.
The required integration tests failed for the above PR.
We attached a debugger to the failing integration test and deep dived into the code.
Further investigation surfaced that com.google.api.services.bigquery.model.Table which extends com.google.api.client.json.GenericJson has the above described bug in it.
Running the following snippet of the code where tablePb is an instance of com.google.api.services.bigquery.model.Table class returns inconsistent response where in-fact both stmts are trying to fetch the same logical information.
tablePb.getNumTotalLogicalBytes() // shall return null
tablePb.get("numTotalLogicalBytes") // shall return a valid long valueThis issue is present not only for numTotalLogicalBytes but also for the following fields
numActiveLogicalBytesnumActivePhysicalBytesnumLongTermLogicalBytesnumLongTermPhysicalBytesnumPartitionsnumTimeTravelPhysicalBytesnumTotalLogicalBytesnumTotalPhysicalBytes
Suggested Fix
- Remove the value from the
@Keyannotation for the above listed fields.