Error using CSVLoader from piggybank

无人久伴 提交于 2019-12-11 05:04:46

问题


I am trying to use CSVLoader from Piggybank. Below are the first two lines of my code:

  register 'piggybank.jar' ;
  define CSVLoader org.apache.pig.piggybank.storage.CSVLoader();

It throws the following error:

  2013-10-24 14:26:51,427 [main] INFO         
  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file    
  system at: file:///
  2013-10-24 14:26:52,029 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve org.apache.pig.piggybank.storage.CSVLoader using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.]

Can someone tell me what's going on? I am executing this script from the same folder where my piggybank.jar is located.


回答1:


I ran into a similar problem when I was experimenting with pig, although it was the XMLLoader for me. The solution that worked for me was to register the entire path to the jar, instead of the relative path. so if the jar is located at /usr/lib/pig/piggybank.jar run the code as follows:

register '/usr/lib/pig/piggybank.jar' ;
  define CSVLoader org.apache.pig.piggybank.storage.CSVLoader();



回答2:


I checked out the code from the url 'http://svn.apache.org/repos/asf/pig/trunk/' and re-built the jar file. IT works fine now. :)




回答3:


The same is working fine register 'piggybank.jar' ; A = load '/xmlinput/demo.xml' using org.apache.pig.piggybank.storage.XMLLoader('property') as (x:chararray); B = foreach A generate REPLACE(x,'[\n]','') as x; C = foreach B generate REGEX_EXTRACT_ALL(x,'.(?:)([^<]).(?:)([^<]).*'); D =FOREACH C GENERATE FLATTEN (($0)); STORE D INTO 'xmlcsvpig' USING org.apache.pig.piggybank.storage.CSVExcelStorage();



来源:https://stackoverflow.com/questions/19573764/error-using-csvloader-from-piggybank

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!