1
我有一個豬描述相似的是:如何乘法計算在SUM PigLatin
DESCRIBE B;
B: {group: chararray, A: {name: chararray,age: int,gpa: float}}
我想計算∑B.A.gpa2
豬
,但如果我寫:
FOREACH B {
out = SUM(A.gpa * A.gpa);
}
它扔掉這樣的模糊:
[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1039: <file test.pig, line xx, column xx> (Name: Multiply Type: null Uid: null)incompatible types in Multiply Operator left hand side:bag :tuple(gpa:float) right hand side:bag :tuple(gap:float)
我問過豬羣的解決方案,這是吉拉link
有人對我的問題有其他建議嗎?
我的臨時解決方案是
FOREACH B {
tmp_out = FOREACH A GENERATE gpa*gap;
out = SUM(tmp_out);
}