我如何让RANK从索引0而不是1开始?
A = RANK A
(1, 2)
(2, 2)
答案 0 :(得分:3)
如果需要,可以使用一种解决方法。我不认为有特殊的RANK函数开始从0开始给出排名值
输入:
(100,surender)
(101,raja)
(102,kumar)
Pig Script:
records = LOAD '/home/dir/records.txt' USING PigStorage(',');
records_rank = RANK records;
records_each = FOREACH records_rank GENERATE ($0-1),$1,$2;
dump records_each;
输出:
(0,100,surender)
(1,101,raja)
(2,102,kumar)