如何使用piggybank删除标题?

时间:2016-09-13 21:21:33

标签: apache-pig bigdata

我有一个目录,其中包含10个文件,我想从目录中的文件中删除标题,并在使用piggybank执行时,我收到错误。有没有其他方法可以从目录中的所有文件中删除标题。我的代码是: -

REGISTER /usr/lib/pig/piggybank.jar;
input = LOAD 'insurance_data' using CSVExcelStorage(
    ',','default','NOCHANGE','SKIP_INPUT_HEADER')
as (population:int, private:int,public:int,uninsecured:int);
dump input;

我得到的错误是: -

  

2016-09-13 14:01:48,239 [main] ERROR org.apache.pig.PigServer -   解析期间的异常:解析期间出错。期望EOF的输入'输入'不匹配无法解析:     期望输入'输入'不匹配   EOF在   org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:241)     在   org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:179)     在org.apache.pig.PigServer $ Graph.parseQuery(PigServer.java:1688)at at   org.apache.pig.PigServer $ Graph.access $ 000(PigServer.java:1421)at at   org.apache.pig.PigServer.parseAndBuild(PigServer.java:354)at   org.apache.pig.PigServer.executeBatch(PigServer.java:379)at   org.apache.pig.PigServer.executeBatch(PigServer.java:365)at   org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:140)     在   org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:769)     在   org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)     在   org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198)     在   org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173)     在org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)at   org.apache.pig.Main.run(Main.java:613)at   org.apache.pig.Main.main(Main.java:158)at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at   org.apache.hadoop.util.RunJar.run(RunJar.java:221)at   org.apache.hadoop.util.RunJar.main(RunJar.java:136)2016-09-13   14:01:48,250 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR   1200:输入'输入'不匹配   期待日志文件中的EOF详细信息:/home/cloudera/pig_1473800504430.log

1 个答案:

答案 0 :(得分:0)

'input'是一个keyword.Reference here。将关系'input'的名称更改为其他名称。

REGISTER /usr/lib/pig/piggybank.jar;
A = LOAD 'insurance_data' USING CSVExcelStorage(',','default','NOCHANGE','SKIP_INPUT_HEADER') as (population:int, private:int,public:int,uninsecured:int);
DUMP A;