This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d99d02  NIFI-7043: This closes #3999. When a Record incorporates its 
'inactive fields' the schema should not change if there are no inactive fields 
(i.e., if the record has not been modified in such a way that any new fields 
were added to its schema) NIFI-7043: Account for case where 
MapRecord.incorporateInactiveFields is called, and there are no inactive 
fields, but there are updated fields (i.e., fields whose type has changed from 
the schema).
3d99d02 is described below

commit 3d99d02f93067937aa58859e9868b13e942630e1
Author: Mark Payne <[email protected]>
AuthorDate: Sat Jan 18 10:19:03 2020 -0500

    NIFI-7043: This closes #3999. When a Record incorporates its 'inactive 
fields' the schema should not change if there are no inactive fields (i.e., if 
the record has not been modified in such a way that any new fields were added 
to its schema)
    NIFI-7043: Account for case where MapRecord.incorporateInactiveFields is 
called, and there are no inactive fields, but there are updated fields (i.e., 
fields whose type has changed from the schema).
    
    Signed-off-by: Joe Witt <[email protected]>
---
 .../java/org/apache/nifi/serialization/record/MapRecord.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java
 
b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java
index ce8708c..688899b 100644
--- 
a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java
+++ 
b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/MapRecord.java
@@ -443,8 +443,18 @@ public class MapRecord implements Record {
     public void incorporateInactiveFields() {
         final List<RecordField> updatedFields = new ArrayList<>();
 
+        boolean fieldUpdated = false;
         for (final RecordField field : schema.getFields()) {
-            updatedFields.add(getUpdatedRecordField(field));
+            final RecordField updated = getUpdatedRecordField(field);
+            if (!updated.equals(field)) {
+                fieldUpdated = true;
+            }
+
+            updatedFields.add(updated);
+        }
+
+        if (!fieldUpdated && (inactiveFields == null || 
inactiveFields.isEmpty())) {
+            return;
         }
 
         if (inactiveFields != null) {

Reply via email to