ahmedabu98 commented on code in PR #34102:
URL: https://github.com/apache/beam/pull/34102#discussion_r1979648985
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java:
##########
@@ -539,16 +539,14 @@ public static DynamicMessage messageFromMap(
if
(fieldSchemaInformation.getType().equals(TableFieldSchema.Type.STRUCT)
&& unknownFields != null) {
- if (unknownFields.get(key) instanceof Map
- && ((Map<?, ?>) unknownFields.get(key)).isEmpty()) {
+ if ((unknownFields.get(key) instanceof Map
+ && ((Map<?, ?>) unknownFields.get(key)).isEmpty()) // single
struct, empty
+ || (unknownFields.get(key)
+ instanceof List // repeated struct, empty list or list
with empty structs
+ && (((List<?>) unknownFields.get(key)).isEmpty()
+ || ((List<?>) unknownFields.get(key))
+ .stream().allMatch(row -> row == null || ((Map<?,
?>) row).isEmpty())))) {
Review Comment:
I guess we can also merge with the outer if-statement? this is gonna be a
monster of an if-statement.
Maybe there's a way to clean it up, but it's not PR-blocking so will leave
it up to you.
--
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]