public interface RecordReader extends Closeable
A RowRecordReader is responsible for parsing data and returning a record at a time in order to allow the caller to iterate over the records individually.
PLEASE NOTE: This interface is still considered 'unstable' and may change in a non-backward-compatible manner between minor or incremental releases of NiFi.
Modifier and Type | Method and Description |
---|---|
default RecordSet |
createRecordSet() |
RecordSchema |
getSchema() |
default Record |
nextRecord()
Returns the next record in the stream or
null if no more records are available. |
Record |
nextRecord(boolean coerceTypes,
boolean dropUnknownFields)
Reads the next record from the underlying stream.
|
default Record nextRecord() throws IOException, MalformedRecordException
null
if no more records are available. Types will be coerced and any unknown fields will be dropped.null
if no more records are available.IOException
- if unable to read from the underlying dataMalformedRecordException
- if an unrecoverable failure occurs when trying to parse a recordSchemaValidationException
- if a Record contains a field that violates the schema and cannot be coerced into the appropriate field type.Record nextRecord(boolean coerceTypes, boolean dropUnknownFields) throws IOException, MalformedRecordException
Record.getValue(org.apache.nifi.serialization.record.RecordField)
may return any type of Object, such as a String or another Record, even though the schema indicates that the field must be an integer.coerceTypes
- whether or not fields in the Record should be validated against the schema and coerced when necessarydropUnknownFields
- if true
, any field that is found in the data that is not present in the schema will be dropped. If false
,
those fields will still be part of the Record (though their type cannot be coerced, since the schema does not provide a type for it).null
if no more records are availableIOException
- if unable to read from the underlying dataMalformedRecordException
- if an unrecoverable failure occurs when trying to parse a record, or a Record contains a field
that violates the schema and cannot be coerced into the appropriate field type.SchemaValidationException
- if a Record contains a field that violates the schema and cannot be coerced into the appropriate
field type and schema enforcement is enabledRecordSchema getSchema() throws MalformedRecordException
MalformedRecordException
- if an unrecoverable failure occurs when trying to parse the underlying datadefault RecordSet createRecordSet()
Copyright © 2021 Apache NiFi Project. All rights reserved.