pig latin - load with text qualifier -
i trying load datafile in pig latin script, data has 2 columns there text qualifier in 2nd column , sample data below :
device_id,supported_tech a2334,"gsm900,gsm1500,gsm200" a54623,"gsm900,gsm1500" a86646,"gsm1500,gsm200"
when try loading date below, 2nd column not recognized 1 column
devicelist = load 'devicelist.csv' using pigstorage(',') (device_id:chararray, supported_tech:chararray );
how can define text qualifier while loading data set ?
try , let me know if need different output format
input.txt
device_id,supported_tech a2334,"gsm900,gsm1500,gsm200" a54623,"gsm900,gsm1500" a86646,"gsm1500,gsm200
pigscript:
a = load 'input.txt' line; devicelist = foreach generate flatten(regex_extract_all(line,'^(\\w+),(.*)$')) (device_id:chararray, supported_tech:chararray ); dump devicelist;
output:
(device_id,supported_tech) (a2334,"gsm900,gsm1500,gsm200") (a54623,"gsm900,gsm1500") (a86646,"gsm1500,gsm200")
Comments
Post a Comment