为什么我不能在Pig Latin中正确使用歧义运算符

时间:2015-08-18 00:13:46

标签: hadoop apache-pig

grunt> describe aa
aa: {header: int}
grunt> aa = FOREACH aa GENERATE aa::header as h2; 
2015-08-18 00:09:56,405 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1025: 
<line 7, column 25> Invalid field projection. Projected field [aa::header] does not exist in schema: header:int.
Details at logfile: /export/home/capsrch/pig_1439855906404.log
grunt> aa = FOREACH aa GENERATE header as h2;    
grunt> describe aa;
aa: {h2: int}

我的问题是为什么第3行的FOREACH aa GENERATE aa::header as h2;失败了。我在那里没有使用::运算符吗?

1 个答案:

答案 0 :(得分:1)

参考:http://pig.apache.org/docs/r0.12.0/basic.html#disambiguate

从以上链接中摘录:

Use the disambiguate operator ( :: ) to identify field names after JOIN, COGROUP, CROSS, or FLATTEN operators.

在运算符之后是'aa'别名:JOIN,COGROUP,CROSS还是FLATTEN?如果没有,则使用消歧算子解决不存在歧义。