猪的MultiStorage

时间:2015-11-03 10:48:39

标签: hadoop apache-pig

我在grunt shell中运行了下面的pig脚本

Register D:\Pig\contrib\piggybank\java\piggybank.jar;

a = load '/part' using PigStorage(',') as (uuid:chararray,timestamp:chararray,Name:chararray,EmailID:chararray,CompanyName:chararray,Location:chararray);

store a  into '/output/multistorage' USING MultiStorage('/output/multistorage','2', 'none', ',');

运行此操作时会抛出错误,如下所示

2015-11-03 05:47:36,328 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 10
70: Could not resolve MultiStorage using imports: [, java.lang., org.apache.pig.
builtin., org.apache.pig.impl.builtin.]

任何人都能帮助我吗?

1 个答案:

答案 0 :(得分:1)

您没有导入您的功能作为日志声明。如果实际上可以访问jar,则可以尝试以下代码(缺少一行):

REGISTER D:\Pig\contrib\piggybank\java\piggybank.jar; 
DEFINE MULTISTORAGE org.apache.pig.piggybank.storage.MultiStorage(); 
a = LOAD'/part' USING PigStorage(',') AS (uuid:chararray,timestamp:chararray,Name:chararray,EmailID:chararray,CompanyName:chararray,Location:chararray); 
STORE a  into '/output/multistorage' USING MULTISTORAGE('/output/multistorage','2', 'none', ',');

然后按名称分区。