Tuesday, 4 November 2014

Pig Read CSV Files


USING CSVExcelStorage(['<delimiter>' [,{'YES_MULTILINE' | 'NO_MULTILINE'} [,{'UNIX' | 'WINDOWS' | 'UNCHANGED'}]]]);

Defaults are comma, 'NO_MULTILINE', 'UNCHANGED' The linebreak parameter is only used during store. During load no conversion is performed.


Example,
raw_data = LOAD '$INPUT_PATH' USING org.apache.pig.piggybank.storage.CSVExcelStorage
(',', 'SKIP_INPUT_HEADER')
 AS (year:int, month: int, unique_carrier:chararray);

http://pig.apache.org/docs/r0.9.2/api/org/apache/pig/piggybank/storage/CSVExcelStorage.html

No comments:

Post a Comment