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


##########
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:
   In our case the records are `MapRecord` instances, and `MapRecord` (and 
other `Record` implementations) do not implement `Serializable`. Besides, Java 
serialization would add noticeable overhead on a hot path that can process 
large batches, whereas the current approach only walk the map/collection 
structures we actually store.



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