-Pivot table with zeros instead of empty
Eugene Morozov 2013-03-06, 15:20
I have a script that gives me following result:
time_grouped = GROUP joined BY (ip, hour);
counts = FOREACH time_grouped GENERATE group.ip as ip, group.hour as hour,
COUNT(joined) as count;
(18.104.22.168, 0, 180)
(22.214.171.124, 1, 84)
(126.96.36.199, 2, 25)
(188.8.131.52, 22, 31)
(184.108.40.206, 23, 2)
That is IP address, hour of day, counter.
I'd like to get following:
(220.127.116.11, (m1,m2, m3, ..., m23))
m1-m23 corresponds to the counter. And if there is nothing for particular
hour, then I'd like to have 0 instead empty value.
The trick here is that if I do not have anything for particular hour, then
I won't have count for it.
Is there a way to achieve the goal?
Thanks in advance
Developer Grid Dynamics
Prashant Kommireddi 2013-03-07, 08:04
Eugene Morozov 2013-03-08, 08:55
Eugene Morozov 2013-03-08, 19:21