Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 1b2f110

Browse files
authored
fix: BQ Numeric is compatible with double and float protobuf types (#367)
Fixed a bug and made BQ Numeric compatible with double and float protobuf types.
1 parent 67626bd commit 1b2f110

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1alpha2/SchemaCompatibility.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ private static boolean isCompatibleWithBQNumeric(Descriptors.FieldDescriptor.Typ
206206
return true;
207207
}
208208

209+
if (field == Descriptors.FieldDescriptor.Type.FLOAT
210+
|| field == Descriptors.FieldDescriptor.Type.DOUBLE) {
211+
return true;
212+
}
213+
209214
return false;
210215
}
211216

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/SchemaCompatibilityTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,9 @@ public void testBQNumeric() {
729729
Fixed64Type.getDescriptor(),
730730
SFixed32Type.getDescriptor(),
731731
SFixed64Type.getDescriptor(),
732-
BytesType.getDescriptor()));
732+
BytesType.getDescriptor(),
733+
FloatType.getDescriptor(),
734+
DoubleType.getDescriptor()));
733735

734736
for (Descriptors.Descriptor descriptor : type_descriptors) {
735737
if (compatible.contains(descriptor)) {

0 commit comments

Comments
 (0)