tilgalas commented on code in PR #30638:
URL: https://github.com/apache/beam/pull/30638#discussion_r1526682326
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/AvroGenericRecordToStorageApiProto.java:
##########
@@ -262,8 +262,7 @@ private static TableFieldSchema
fieldDescriptorFromAvroField(Schema.Field field)
elementType.getType() != Schema.Type.UNION,
"Multiple non-null union types are not supported.");
TableFieldSchema unionFieldSchema =
- fieldDescriptorFromAvroField(
- new Schema.Field(field.name(), elementType, field.doc(),
field.defaultVal()));
Review Comment:
the `elementType` here will be a schema of the union, but with the null type
filtered out - in the "extreme" case of an "optionable" union type of `[null,
SomeSchema]` it won't even be a union anymore, just the bare `SomeSchema` - if
the `defaultVal` is `null`, it will not correspond to this derived schema
anymore, and Avro will throw an exception when constructing the `Field` object
- I'm not sure why this wasn't a problem before (maybe Avro didn't actually
checked this?)
--
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]