4

So my data looks something like this

asdf, asdf, "adsf,qwef", asdf 

When i read that data in pig using

PigStorage(',')

It stores the "adsf,qwef" as a two data, and stores it like

{ "adsf } { qwef" } 

I want quotes to be treated as single data.

What should I do?

Im trying to write a pigscript to do this.

1 Answer 1

7

You should use the CSVLoader:

data = LOAD 'my.csv' USING org.apache.pig.piggybank.storage.CSVExcelStorage() 
    AS (...);

Where the ... is the identifiers.

NOTE: You'll have to register the Piggybank first. Details here: https://cwiki.apache.org/confluence/display/PIG/PiggyBank

3
  • is this a separate function besides the pig? Jul 23, 2013 at 17:07
  • because it gives me error 2013-07-23 10:06:17,190 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve org.apache.pig.piggybank.storage.CSVExcelStorage using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.] Jul 23, 2013 at 17:07
  • 2
    This has been updated/renamed to 'org.apache.pig.piggybank.storage.CSVLoader()'
    – drtf
    Jun 28, 2016 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.