出于某种原因,我无法掌握此功能的正确语法。
我有一个名为testing.txt的文件:
1
2
3
4
5
6
7
8
我有一个Pig脚本:
testing = load '/testing.txt' using PigStorage(',') as (var1:double);
t = foreach testing generate var1, var1 as var2;
grp = group t all;
result = foreach grp generate AVG(t.var1) as average, COV(t.var1,t.var2) as variance;
dump result;
这应该给我平均值和方差。
我也尝试了这个:
testing = load '/testing.txt' using PigStorage(',') as (var1:double);
grp = group t all;
result = foreach grp generate AVG(testing.var1) as average, COV(testing.var1,testing.var1) as variance;
dump result;
这两个脚本都给出了同样的错误:
ERROR 2078: Caught error from UDF: org.apache.pig.builtin.COV$Intermed [Caught exception in COV.Intermed]
我查看了Java code并找不到任何与众不同的东西。
我想知道如何在Pig中使用功能COV。