我写了一个非常简单的 Python,这是我的 UDF 代码、pig 代码和错误消息,有什么问题吗?谢谢。
UDF(测试.py),
@outputSchema("cookie:chararray")
def getSimple():
return 'Hello'
pig 代码,
register test.py using jython as TestSimple;
a = TestSimple.getSimple() as word;
错误信息,
[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 1, column 0> Syntax error, unexpected symbol at or near 'a'
提前致谢, 林
最佳答案
你需要加载一些数据而不是用你的 UDF 处理它。 像: 加载数据:
A = LOAD 'input' USING PigStorage('\t','-schema');
使用 UDF 处理您的数据,假设您的输入中有一个 id 字段:
B = FOREACH A GENERATE TestSimple.getSimple(id) as word;
当然,您需要正确注册您的 UDF。
关于python - Hadoop pig 的简单 Python UDF 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32261630/