我正在尝试使用python udf,但它丢失了以下错误。我正在使用CDH5.2
cat /home/spanda20/pig_data/panda1.py
def get_length(data):
return len(data)
REGISTER '/home/spanda20/pig_data/panda1.py' USING jython as my_udf;
grunt> A = LOAD 'hdfs://itsusmpl00509.jnj.com:8020/user/spanda20/pig_1.dat' USING PigStorage(',') AS (name:chararray, id:int);
grunt> B = FOREACH A GENERATE name, id,my_udf.get_length(name) as name_len;
2015-01-25 20:47:15,243 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070:无法解决 my_udf.get_length使用导入:[,java.lang。, org.apache.pig.builtin。,org.apache.pig.impl.builtin。] 详情请见 logfile:/home/spanda20/pig_1422230028021.log
答案 0 :(得分:4)
有时,在针对UDF的pig REGISTER 命令失败后,您可能必须重新启动PIG的客户端才能重新加载UDF