This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new a1c755814e5 NIFI-16175 Documented ValidateRecord behavior for
zero-record input (#11514)
a1c755814e5 is described below
commit a1c755814e580efdf6b45ab6936409195ba097bc
Author: Lars Francke <[email protected]>
AuthorDate: Fri Aug 7 16:37:47 2026 +0200
NIFI-16175 Documented ValidateRecord behavior for zero-record input (#11514)
Signed-off-by: David Handermann <[email protected]>
---
.../org/apache/nifi/processors/standard/ValidateRecord.java | 3 ++-
.../additionalDetails.md | 13 ++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java
index d0b926ed553..8971635d4f6 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java
@@ -90,7 +90,8 @@ import static
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION;
+ "records that do not adhere to the schema are routed to the \"invalid\"
relationship. It is therefore possible for a single incoming FlowFile to be
split into two individual "
+ "FlowFiles if some records are valid according to the schema and others
are not. Any FlowFile that is routed to the \"invalid\" relationship will emit
a ROUTE Provenance Event "
+ "with the Details field populated to explain why records were invalid.
In addition, to gain further explanation of why records were invalid,
DEBUG-level logging can be enabled "
- + "for the \"org.apache.nifi.processors.standard.ValidateRecord\" logger.")
+ + "for the \"org.apache.nifi.processors.standard.ValidateRecord\" logger. "
+ + "If the incoming FlowFile contains no records, no output FlowFile is
produced for any relationship and the incoming FlowFile is removed.")
@WritesAttributes({
@WritesAttribute(attribute = "mime.type", description = "Sets the
mime.type attribute to the MIME Type specified by the Record Writer"),
@WritesAttribute(attribute = "record.count", description = "The number of
records in the FlowFile routed to a relationship")
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.ValidateRecord/additionalDetails.md
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.ValidateRecord/additionalDetails.md
index d04d14b9124..24a914b6bb0 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.ValidateRecord/additionalDetails.md
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.ValidateRecord/additionalDetails.md
@@ -15,6 +15,17 @@
# ValidateRecord
+## FlowFiles that contain no records
+
+ValidateRecord validates records one at a time as they are read from the
incoming FlowFile. If the Record Reader
+returns no records - for example, a CSV input that contains only a header line
- the processor has nothing to validate.
+In this case no output is produced: no FlowFile is routed any relationship,
and the incoming FlowFile is removed.
+
+If a downstream flow needs to react to empty inputs, detect them before
ValidateRecord. For example, a preceding
+record-based processor such as ConvertRecord writes a `record.count` attribute
(including `record.count = 0` for empty
+inputs when its *Include Zero Record FlowFiles* property is enabled), which a
RouteOnAttribute processor can then use to
+handle empty FlowFiles separately.
+
## Examples for the effect of Force Types From Reader's Schema property
The processor first reads the data from the incoming FlowFile using the
specified Record Reader, which uses a schema.
@@ -180,4 +191,4 @@ in **Example 2**, but instead of JsonRecordSetWriter, we
used XMLRecordSetWriter
```
However, if **Force Types From Reader's Schema = true** this output is routed
to the **valid** relationship and if *
-*Force Types From Reader's Schema = false** it is routed to the **invalid**
relationship.
\ No newline at end of file
+*Force Types From Reader's Schema = false** it is routed to the **invalid**
relationship.