Package org.apache.nifi.csv
Class CSVReader
- All Implemented Interfaces:
ConfigurableComponent
,ControllerService
,RecordReaderFactory
@Tags({"csv","parse","record","row","reader","delimited","comma","separated","values"})
@CapabilityDescription("Parses CSV-formatted data, returning each row in the CSV file as a separate record. This reader allows for inferring a schema based on the first line of the CSV, if a \'header line\' is present, or providing an explicit schema for interpreting the values. See Controller Service\'s Usage for further documentation.")
public class CSVReader
extends SchemaRegistryService
implements RecordReaderFactory
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AllowableValue
private String
private ConfigurationContext
static final PropertyDescriptor
private org.apache.commons.csv.CSVFormat
private String
private String
static final AllowableValue
private boolean
private static final AllowableValue
private boolean
static final AllowableValue
private String
private String
static final PropertyDescriptor
Fields inherited from class org.apache.nifi.serialization.SchemaRegistryService
schemaAccessStrategy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateRecordReader
(Map<String, String> variables, InputStream in, long inputLength, ComponentLog logger) protected AllowableValue
protected SchemaAccessStrategy
getSchemaAccessStrategy
(String allowableValue, SchemaRegistry schemaRegistry, PropertyContext context) protected List
<AllowableValue> protected List
<PropertyDescriptor> void
Methods inherited from class org.apache.nifi.serialization.SchemaRegistryService
buildStrategyProperty, customValidate, getConfigurationContext, getSchema, getSchema, getSchemaAccessStrategy, getSchemaAccessStrategyDescriptor, getSuppliedSchemaFields, migrateProperties, storeSchemaAccessStrategy
Methods inherited from class org.apache.nifi.controller.AbstractControllerService
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabled
Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
Methods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migrateProperties
Methods inherited from interface org.apache.nifi.serialization.RecordReaderFactory
createRecordReader
-
Field Details
-
HEADER_DERIVED
-
APACHE_COMMONS_CSV
-
JACKSON_CSV
-
FAST_CSV
-
CSV_PARSER
-
TRIM_DOUBLE_QUOTE
-
context
-
csvParser
-
dateFormat
-
timeFormat
-
timestampFormat
-
firstLineIsHeader
private volatile boolean firstLineIsHeader -
ignoreHeader
private volatile boolean ignoreHeader -
charSet
-
csvFormat
private volatile org.apache.commons.csv.CSVFormat csvFormat
-
-
Constructor Details
-
CSVReader
public CSVReader()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptors
in classSchemaRegistryService
-
storeStaticProperties
-
createRecordReader
public RecordReader createRecordReader(Map<String, String> variables, InputStream in, long inputLength, ComponentLog logger) throws IOException, SchemaNotFoundException- Specified by:
createRecordReader
in interfaceRecordReaderFactory
- Throws:
IOException
SchemaNotFoundException
-
getSchemaAccessStrategy
protected SchemaAccessStrategy getSchemaAccessStrategy(String allowableValue, SchemaRegistry schemaRegistry, PropertyContext context) - Overrides:
getSchemaAccessStrategy
in classSchemaRegistryService
-
getSchemaAccessStrategyValues
- Overrides:
getSchemaAccessStrategyValues
in classSchemaRegistryService
-
getDefaultSchemaAccessStrategy
- Overrides:
getDefaultSchemaAccessStrategy
in classSchemaRegistryService
-