pvillard31 commented on code in PR #10334:
URL: https://github.com/apache/nifi/pull/10334#discussion_r2379579949


##########
nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecord.java:
##########
@@ -773,6 +770,47 @@ private Object coerceStringToLong(final String fieldName, 
final String stringVal
                 : stringValue;
     }
 
+    private Record cloneRecord(final Record record) {
+        final Map<String, Object> valuesCopy = cloneValues(record.toMap());
+        return new MapRecord(record.getSchema(), valuesCopy, 
record.isTypeChecked(), record.isDropUnknownFields());
+    }
+
+    private Map<String, Object> cloneValues(final Map<String, Object> values) {
+        final Map<String, Object> cloned = new LinkedHashMap<>(values.size());
+        for (final Map.Entry<String, Object> entry : values.entrySet()) {
+            cloned.put(entry.getKey(), cloneValue(entry.getValue()));
+        }
+        return cloned;
+    }
+
+    private Object cloneValue(final Object value) {

Review Comment:
   I guess it could, but I'm not sure this is really a pattern we would want to 
encourage. The scenario here is quite specific. Others may have a different 
opinion though.



-- 
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]

Reply via email to