Skip to content

Commit ad136b9

Browse files
feat: add schema aware stream writer (#2048)
* feat: add schema aware stream writer * [squash this commit] Fix clirr errors * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 8eda934 commit ad136b9

File tree

10 files changed

+834
-408
lines changed

10 files changed

+834
-408
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you are using Maven without BOM, add this to your dependencies:
4949
If you are using Gradle 5.x or later, add this to your dependencies:
5050

5151
```Groovy
52-
implementation platform('com.google.cloud:libraries-bom:26.11.0')
52+
implementation platform('com.google.cloud:libraries-bom:26.12.0')
5353
5454
implementation 'com.google.cloud:google-cloud-bigquerystorage'
5555
```

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/Exceptions.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ public String getStreamName() {
243243
}
244244

245245
/**
246-
* This exception is thrown from {@link JsonStreamWriter#append()} when the client side Json to
247-
* Proto serializtion fails. It can also be thrown by the server in case rows contains invalid
246+
* This exception is thrown from {@link SchemaAwareStreamWriter#append()} when the client side
247+
* Proto serialization fails. It can also be thrown by the server in case rows contains invalid
248248
* data. The exception contains a Map of indexes of faulty rows and the corresponding error
249249
* message.
250250
*/
@@ -362,16 +362,27 @@ protected InflightBytesLimitExceededException(String writerId, long currentLimit
362362
currentLimit);
363363
}
364364
}
365+
365366
/**
366-
* Input Json data has unknown field to the schema of the JsonStreamWriter. User can either turn
367-
* on IgnoreUnknownFields option on the JsonStreamWriter, or if they don't want the error to be
368-
* ignored, they should recreate the JsonStreamWriter with the updated table schema.
367+
* This class is replaced by a generic one. It will be removed soon. Please use {@link
368+
* DataHasUnknownFieldException}
369369
*/
370-
public static final class JsonDataHasUnknownFieldException extends IllegalArgumentException {
370+
public static final class JsonDataHasUnknownFieldException extends DataHasUnknownFieldException {
371+
protected JsonDataHasUnknownFieldException(String jsonFieldName) {
372+
super(jsonFieldName);
373+
}
374+
}
375+
/**
376+
* Input data object has unknown field to the schema of the SchemaAwareStreamWriter. User can
377+
* either turn on IgnoreUnknownFields option on the SchemaAwareStreamWriter, or if they don't want
378+
* the error to be ignored, they should recreate the SchemaAwareStreamWriter with the updated
379+
* table schema.
380+
*/
381+
public static class DataHasUnknownFieldException extends IllegalArgumentException {
371382
private final String jsonFieldName;
372383

373-
protected JsonDataHasUnknownFieldException(String jsonFieldName) {
374-
super(String.format("JSONObject has fields unknown to BigQuery: %s.", jsonFieldName));
384+
public DataHasUnknownFieldException(String jsonFieldName) {
385+
super(String.format("The source object has fields unknown to BigQuery: %s.", jsonFieldName));
375386
this.jsonFieldName = jsonFieldName;
376387
}
377388

0 commit comments

Comments
 (0)