将java文件导入pig

时间:2016-07-13 16:16:24

标签: java apache-pig

rawGSODData = LOAD '/usr/local/Cellar/pig/0.12.0/gsod_2016/999999-93816-2016.op.gz' USING org.apache.pig.piggybank.storage.FixedWidthLoader('
1-6, 
8-12, 
15-18,
19-22,
25-30,
32-33,
36-41,
43-44,
47-52,
54-55,
58-63,
65-66,
69-73,
75-76,
79-83,
85-86,
89-93,
96-100,
103-108,
109-109,
111-116,
117-117,
119-123,
124-124,
126-130,
133-138', 
'SKIP_HEADER');

当我尝试运行此代码时,我会收到一条错误

 ERROR 1070: Could not resolve org.apache.pig.piggybank.storage.FixedWidthLoader using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]

我在目录

中有文件FixedWidthLoader.java文件

/usr/local/Cellar/pig/0.12.0/build/classes/org/apache/pig/piggybank/storage

请帮我解决此错误

1 个答案:

答案 0 :(得分:0)

piggybank.jar在哪里?确保你已经在Pig脚本中注册了piggybank.jar。如果没有,请将它添加到pig脚本的顶部。确保piggybank.jar的路径是正确的.Below语句注册jar文件,即位于/ usr / local /中的piggybank

CHARACTER SET utf8