The CSV protocol handler parses delimiter separated text lines.
Options
- same as Line and:
csv.delimiter: The delimiter for splitting the input (Default: , ).
- csv.textDelimiter: The delimiter for strings (Default: ' ).
- addlinenumber: Adds the line number (starting with 0) to the beginning of the line. Remember to add a proper attribute to the schema! (default false).
- csv.floatingFormatter:If used for writing, each double/float value will be formatted using this formatter (default null).
- csv.numgerFormatter: If used for writing, each number other than double/float value will be formatted using this formatter (default null).
- csv.writeMetadata:Should metadata be written? (default false)
- csv.trim: Removes leading and trailing whitespaces in each element (default false)
Example
PQL
CSV Protocol Handler
input = ACCESS({source='CSV', wrapper='GenericPush', transport='File',protocol='CSV', dataHandler='Tuple',options=[['delimiter',','],['textDelimiter',"'"],['readfirstline','true'],['delay','100']], schema=[ ['symbol','String'], ['points','Double'] ] })
CQL
CSV Protocol Handler
CREATE STREAM csv (symbol String, points Double) WRAPPER 'GenericPush' PROTOCOL 'CSV' TRANSPORT 'File' DATAHANDLER 'Tuple' OPTIONS ( delimiter' ',', 'textDelimiter' "'", 'readfirstline' 'true', 'delay' '100')