MapReduce Weird Issue

Bryan Fink bryan at basho.com
Tue Nov 29 07:52:21 EST 2011


On Tue, Nov 29, 2011 at 3:56 AM, Yehuda Zargrov <Yehuda at conduit.com>
wrote:>      .reduce("function(v) {var s={}; for(var i in v)  { var
date=''; var> sum=0; for(var n in v[i]) { if (n === \"date\")
date=v[i][n]; if (n ===> \"sum\") sum=v[i][n]; } if (date in s)
s[date] += sum; else s[date] = sum; }> return[v]; }", :keep =>
true).run
Hi, Yehuda.  I think one of the troubles you're seeing may be
becausethe last statement in your reduce function is "return[v]".  It
lookslike you actually wanted "return[s]".  The function is returning
itsinputs instead of its computation result.
As for why you only see 13 entries instead of hundreds, I'd bet
thateither an error or timeout occurred, and caused a known bug
(whereinputs are returned instead of outputs) to raise its
head:https://issues.basho.com/show_bug.cgi?id=1185
There may be more information in Riak's logs.  Please write back
withwhat you find, and include the version numbers you're using for
Riakand Ripple.

-Bryan




More information about the riak-users mailing list