Search code examples
apache-pig

Pig: How to use a library from Piggybank


I am trying to use a library from Piggybank and it's giving me some errors.

This is my code:

REGISTER /usr/lib/pig/piggybank.jar;
DEFINE CSVExcelStorage org.apache.pig.piggybank.storage.CSVExcelStorage; 
a = LOAD 'csvtest/' USING CSVExcelStorage()

And the errors:

2015-09-15 00:18:15,480 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 101: file '/usr/lib/pig/piggybank.jar' does not exist.

I followed the instructions from this guide, PiggyBank, and already built the project.

Should I move piggybank.jar to /usr/lib/pig/piggybank.jar?

Thanks.


Solution

  • REGISTER <path of piggybank jar>;
    

    You need you specify the path of the jar in your local system where you have extracted the pig.

    For example this the path for me:

    /Users/username/pig-0.13.0/lib/piggybank.jar