prodriguezdefino commented on code in PR #32512: URL: https://github.com/apache/beam/pull/32512#discussion_r1801667450
########## sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProto.java: ########## @@ -291,9 +307,17 @@ private static Object toProtoValue( if (arrayElementType == null) { throw new RuntimeException("Unexpected null element type!"); } - return list.stream() - .map(v -> toProtoValue(fieldDescriptor, arrayElementType, v)) - .collect(Collectors.toList()); + boolean shouldFlatMap = + arrayElementType.getTypeName().isCollectionType() + || arrayElementType.getTypeName().isMapType(); + + Stream<Object> valueStream = + list.stream().map(v -> toProtoValue(fieldDescriptor, arrayElementType, v)); + + if (shouldFlatMap) { + valueStream = valueStream.flatMap(vs -> ((List) vs).stream()); Review Comment: See the comment here: https://github.com/apache/beam/pull/22179#discussion_r1037400402 -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org