所以,我有一个数据,它有两个值,字符串和一个数字。
data(string:chararray, number:int)
我计算了 5 条不同的规则,
1:int为0~1。
2:int为1~2。
~
5:int为4~5。
所以我能够单独计算它们,
zero_to_one = filter avg_user by average_stars >= 0 and average_stars <= 1;
A = GROUP zero_to_one ALL;
zto_count = FOREACH A GENERATE COUNT(zero_to_one);
one_to_two = filter avg_user by average_stars > 1 and average_stars <= 2;
B = GROUP one_to_two ALL;
ott_count = FOREACH B GENERATE COUNT(one_to_two);
two_to_three = filter avg_user by average_stars > 2 and average_stars <= 3;
C = GROUP two_to_three ALL;
ttt_count = FOREACH C GENERATE COUNT( two_to_three);
three_to_four = filter avg_user by average_stars > 3 and average_stars <= 4;
D = GROUP three_to_four ALL;
ttf_count = FOREACH D GENERATE COUNT( three_to_four);
four_to_five = filter avg_user by average_stars > 4 and average_stars <= 5;
E = GROUP four_to_five ALL;
ftf_count = FOREACH E GENERATE COUNT( four_to_five);
因此,可以这样做,但这只会产生 5 个单独的表。
我想看看有什么办法(可以花哨,我喜欢花哨的东西) T 可以在单表中生成结果。
这意味着如果
zto_count = 1
ott_count = 3
. = 2
. = 3
. = 5
那么表格将是 {1,3,2,3,5}
解析数据并以这种方式组织它们很容易。
有什么办法吗?