代码块中的语法错误

时间:2013-07-22 10:35:59

标签: apache-pig

我遇到了这个我无法解决的合成错误;

grunt> describe x;
x: {id: int,b: {(first: int,second: int)}}

grunt> res = foreach x {f = FLATTEN(b); generate id,f;}
2013-07-22 12:28:53,050 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 11, column 21>  Syntax error, unexpected symbol at or near 'FLATTEN'

我该怎么做?

1 个答案:

答案 0 :(得分:2)

请参阅http://pig.apache.org/docs/r0.11.0/basic.html#foreach

嵌套块中只允许使用CROSS,DISTINCT,FILTER,FOREACH,LIMIT和ORDER BY。

尝试

res = FOREACH x GENERATE id, FLATTEN(b.(first, second));