大家好,我是 Pig 的新手,我正在尝试遵循 pig 脚本:
然后它显示以下错误:ERROR 1000:解析期间出错。无法使用参数“null”实例化“UPER”日志文件中的详细信息:/home/training/pig_1371303109105.log
我的猪脚本:
register udf.jar;
A = LOAD 'data1.txt' USING PigStorage(',') AS (name:chararray, class:chararray, age:int);
B = foreach A generate UPER(class);
我遵循本教程。
我的java类是:
enter code here
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import java.io.*;
public class UPER extends EvalFunc<String>{
@Override
public String exec(Tuple input) throws IOException {
// TODO Auto-generated method stub
if(input == null ||input.size() ==0)
return null;
try
{
String str=(String)input.get(0);
return str.toUpperCase();
}
catch(Exception e){
throw new IOException("Caught exception processing input row ", e);
}}
}