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.
|
@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 value
This issue is present not only for numTotalLogicalBytes but also for the following fields
numActiveLogicalBytes
numActivePhysicalBytes
numLongTermLogicalBytes
numLongTermPhysicalBytes
numPartitions
numTimeTravelPhysicalBytes
numTotalLogicalBytes
numTotalPhysicalBytes
Suggested Fix
- Remove the value from the
@Key annotation for the above listed fields.
version: v2-rev20230408-2.0.0
Description
The
numTotalLogicalBytesfield ofcom.google.api.services.bigquery.model.Tableclass has an incorrect@Keyannotation.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@Keyis enough since the json field and the java field have the exact same name.google-api-java-client-services/clients/google-api-services-bigquery/v2/2.0.0/com/google/api/services/bigquery/model/Table.java
Lines 260 to 261 in 09b3ea5
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.Tablewhich extendscom.google.api.client.json.GenericJsonhas the above described bug in it.Running the following snippet of the code where
tablePbis an instance ofcom.google.api.services.bigquery.model.Tableclass returns inconsistent response where in-fact both stmts are trying to fetch the same logical information.This issue is present not only for
numTotalLogicalBytesbut also for the following fieldsnumActiveLogicalBytesnumActivePhysicalBytesnumLongTermLogicalBytesnumLongTermPhysicalBytesnumPartitionsnumTimeTravelPhysicalBytesnumTotalLogicalBytesnumTotalPhysicalBytesSuggested Fix
@Keyannotation for the above listed fields.