dan-s1 commented on code in PR #9151:
URL: https://github.com/apache/nifi/pull/9151#discussion_r1707446785
##########
nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/proto/ProtoUtils.java:
##########
@@ -46,8 +48,22 @@ public static DynamicMessage
createMessage(Descriptors.Descriptor descriptor, Ma
switch (field.getType()) {
case MESSAGE:
if (field.isRepeated()) {
- Collection collection = value.getClass().isArray() ?
Arrays.asList((Object[]) value) : (Collection) value;
- collection.forEach(act -> builder.addRepeatedField(field,
createMessage(field.getMessageType(), (Map<String, Object>) act, tableSchema)));
+ final Collection<Map<String, Object>> valueMaps;
+ if (value instanceof Object[] arrayValue) {
+ valueMaps = Arrays.stream(arrayValue)
+ .map(item -> (Map<String, Object>)
item).toList();
+ } else if (value instanceof HashMap<?, ?> hashMapValue) {
Review Comment:
If value is a Map, is it always guaranteed to be specifically a `HashMap`?
--
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]