Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-bigquerystorage'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.19.1'
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.20.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.19.1"
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.20.0"
```

## Authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ private static void fillRepeatedField(
try {
jsonArray = json.getJSONArray(exactJsonKeyName);
} catch (JSONException e) {
java.lang.Object val = json.get(exactJsonKeyName);
// It is OK for repeated field to be null.
if (val == JSONObject.NULL) {
return;
}
throw new IllegalArgumentException(
"JSONObject does not have a array field at " + currentScope + ".");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,4 +1275,40 @@ public void testBadJsonFieldIntRepeated() throws Exception {
assertEquals(ex.getMessage(), "Text 'blah' could not be parsed at index 0");
}
}

@Test
public void testNullRepeatedField() throws Exception {
TableSchema ts =
TableSchema.newBuilder()
.addFields(
0,
TableFieldSchema.newBuilder()
.setName("test_repeated")
.setType(TableFieldSchema.Type.DATE)
.setMode(TableFieldSchema.Mode.REPEATED)
.build())
.addFields(
1,
TableFieldSchema.newBuilder()
.setName("test_non_repeated")
.setType(TableFieldSchema.Type.DATE)
.setMode(TableFieldSchema.Mode.NULLABLE)
.build())
.build();
JSONObject json = new JSONObject();
// Null repeated field.
json.put("test_repeated", JSONObject.NULL);

DynamicMessage protoMsg =
JsonToProtoMessage.convertJsonToProtoMessage(RepeatedInt32.getDescriptor(), ts, json);
assertTrue(protoMsg.getAllFields().isEmpty());

// Missing repeated field.
json = new JSONObject();
json.put("test_non_repeated", JSONObject.NULL);

protoMsg =
JsonToProtoMessage.convertJsonToProtoMessage(RepeatedInt32.getDescriptor(), ts, json);
assertTrue(protoMsg.getAllFields().isEmpty());
}
}
1 change: 1 addition & 0 deletions google-cloud-bigquerystorage/src/test/proto/jsonTest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ message RepeatedInt64 {

message RepeatedInt32 {
repeated int32 test_repeated = 1;
optional int32 test_non_repeated = 2;
}

message RepeatedDouble {
Expand Down