ValidateRecord 2025.10.2.19¶
捆绑包¶
org.apache.nifi | nifi-standard-nar
描述¶
Validates the Records of an incoming FlowFile against a given schema. All records that adhere to the schema are routed to the "valid" relationship while 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.
输入要求¶
REQUIRED
支持敏感的动态属性¶
false
属性¶
属性 |
描述 |
|---|---|
allow-extra-fields |
如果传入的数据包含架构中不存在的字段,则此属性决定记录是否有效。如果为 true,则记录仍然有效。如果为 false,则由于多余的字段,记录将无效。 |
coerce-types |
If enabled, the processor will coerce every field to the type specified in the Reader 's schema. If the value of a field cannot be coerced to the type, the field will be skipped (will not be read from the input data), thus will not appear in the output. If not enabled, then every field will appear in the output but their types may differ from what is specified in the schema. For details please see the Additional Details page of the processor's Help. This property controls how the data is read by the specified Record Reader. |
invalid-record-writer |
如果指定,则此控制器服务将用于写出任何无效的记录。如果未指定,则由“Record Writer”属性指定的写入器将与用于读取输入记录的架构一起使用。例如,当配置的记录写入器无法写入不符合其架构的数据时(如 Avro 的情况),或者在将有效记录转换为另一种格式时需要保留原始格式的无效记录时,这很有用。 |
maximum-validation-details-length |
指定验证详细信息值可以包含的最大字符数。任何超出最大值的字符都将被截断。仅当设置了“Validation Details Attribute Name”时才使用此属性 |
record-reader |
指定用于读取传入数据的控制器服务 |
record-writer |
指定用于写出记录的控制器服务。无论控制器服务架构访问权限配置如何,都使用用于验证记录的架构来写入有效结果。 |
schema-access-strategy |
指定如何获取用于验证记录的架构 |
schema-branch |
指定在“架构注册表”属性中查找架构时使用的分支名称。如果所选架构注册表不支持分支,则该值将被忽略。 |
schema-name |
指定要在架构注册表属性中查找的架构的名称。 |
schema-registry |
指定用于架构注册表的控制器服务 |
schema-text |
Avro 格式架构的文本 |
schema-version |
指定要在架构注册表中查找的架构版本。如果未指定,则将检索架构的最新版本。 |
strict-type-checking |
如果传入数据的记录的字段类型不正确,则此属性决定如何处理该记录。如果为 true,则记录将被视为无效。如果为 false,则记录将被视为有效,该字段将被强制转换为正确的类型(如果可能,基于记录写入器支持的类型强制转换)。此属性控制如何根据验证架构验证数据。 |
validation-details-attribute-name |
如果指定,则当发生验证错误时,将使用此属性名称留下详细信息。字符数将受到“Maximum Validation Details Length”属性的限制。 |
关系¶
名称 |
描述 |
|---|---|
failure |
如果由于任何原因无法读取、验证或写入记录,则原始 FlowFile 将路由到此关系 |
invalid |
根据架构确定为无效的记录将路由到此关系 |
valid |
根据架构确定为有效的记录将路由到此关系 |
写入属性¶
名称 |
描述 |
|---|---|
mime.type |
将 mime.type 属性设置为记录写入器指定的 MIME 类型 |
record.count |
路由到关系的 FlowFile 中的记录数 |