2017-06-14 52 views
0

我編譯Apache豬0.16在HBase的1.2.5如下:編譯豬0.16上HBase的1.2.5,但HbaseStorge不從源代碼工作

ant jar -Dhadoopversion=23 -Dhbase95.version=1.2.5 

現在我想運行豬代碼如下:

A = LOAD 'test.csv' USING PigStorage('\t') as (id:chararray,note:chararray); 

STORE A into 'hbase://test_me' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('id:id note:note'); 

但是當我想上面的代碼運行,我收到此錯誤:

pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[id:id note:note]' 
at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:199) 
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1819) 
at org.apache.pig.PigServer$Graph.access$000(PigServer.java:1527) 
at org.apache.pig.PigServer.parseAndBuild(PigServer.java:460) 
at org.apache.pig.PigServer.executeBatch(PigServer.java:485) 
at org.apache.pig.PigServer.executeBatch(PigServer.java:471) 
at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:172) 
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:235) 
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:206) 
at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81) 
at org.apache.pig.Main.run(Main.java:630) 
at org.apache.pig.Main.main(Main.java:176) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at org.apache.hadoop.util.RunJar.main(RunJar.java:212) 

回答

0

HBASE需要一個鍵列,您還沒有任何一個!在你的情況,如果ID是鍵列,那麼你應該使用下面的代碼:

A = LOAD 'test.csv' USING PigStorage('\t') as (id:chararray,note:chararray); 
B = FILTER A BY SIZE(id) > 0; 
STORE B into 'hbase://test_me' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('note:note'); 

注:豬會自動拾取ID列鍵。

此外,我希望你的hbase表有家庭'note'