diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
index 72d760d7cbba..84fffaf243e2 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
@@ -624,7 +624,9 @@
src/test/resources/TestValidateRecord/timestamp.avsc
src/test/resources/TestValidateRecord/timestamp.json
src/test/resources/TestLookupRecord/lookup-array-input.json
+ src/test/resources/TestLookupRecord/lookup-array-input-unmatched.json
src/test/resources/TestLookupRecord/lookup-array-output.json
+ src/test/resources/TestLookupRecord/lookup-array-output-unmatched.json
src/test/resources/TestValidateRecord/int-maps-schema.avsc
src/test/resources/TestValidateRecord/int-maps-data.json
src/test/resources/TestValidateRecord/array-and-map-with-null-element.avro
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java
index 1f873a57032a..e25077dc3817 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java
@@ -309,6 +309,7 @@ private Set doInPlaceReplacement(Record record, FlowFile flowFile,
final Map recordPaths = flowFileContext.getKey();
final Map lookupCoordinates = new HashMap<>(recordPaths.size());
final String coordinateKey = lookupService.getRequiredKeys().iterator().next();
+ boolean hasUnmatchedValue = false;
for (final Map.Entry entry : recordPaths.entrySet()) {
final RecordPath recordPath = entry.getValue();
@@ -338,20 +339,22 @@ private Set doInPlaceReplacement(Record record, FlowFile flowFile,
}
if (!lookupValueOption.isPresent()) {
- final Set rels = routeToMatchedUnmatched ? UNMATCHED_COLLECTION : SUCCESS_COLLECTION;
- return rels;
+ hasUnmatchedValue = true;
+ continue;
}
final Object lookupValue = lookupValueOption.get();
final DataType inferredDataType = DataTypeUtils.inferDataType(lookupValue, RecordFieldType.STRING.getDataType());
fieldValue.updateValue(lookupValue, inferredDataType);
-
}
}
- final Set rels = routeToMatchedUnmatched ? MATCHED_COLLECTION : SUCCESS_COLLECTION;
- return rels;
+ if (hasUnmatchedValue) {
+ return routeToMatchedUnmatched ? UNMATCHED_COLLECTION : SUCCESS_COLLECTION;
+ } else {
+ return routeToMatchedUnmatched ? MATCHED_COLLECTION : SUCCESS_COLLECTION;
+ }
}
private Set doResultPathReplacement(Record record, FlowFile flowFile, ProcessContext context, Tuple