reuvenlax commented on code in PR #29114:
URL: https://github.com/apache/beam/pull/29114#discussion_r1372107572
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java:
##########
@@ -213,10 +213,15 @@ private static String
getPrettyFieldName(SchemaInformation schema) {
.put(TableFieldSchema.Type.JSON, "JSON")
.build();
- public static TableFieldSchema.Mode modeToProtoMode(String mode) {
+ public static TableFieldSchema.Mode modeToProtoMode(
+ @Nullable String defaultValueExpression, String mode) {
+ // If there is a default value expression, treat this field as if it were
nullable.
+ if (defaultValueExpression != null) {
+ return TableFieldSchema.Mode.NULLABLE;
+ }
Review Comment:
Added a test - passing in NULL still fails at the BQ level, and the row ends
up in the failedRows PCollection.
Note: if there is a default value, then we _should_ make the proto field
optional, as otherwise there is no good way to take the default value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]