Erlang Map Reduce Example and Multiple Objects

Sean Cribbs sean at basho.com
Mon May 10 11:14:08 EDT 2010


Ted,

What you've simulated in your sequence is the creation of sibling objects. The example assumes the object only has a single value (no siblings) - which means it will only extract the first one, which is why you got only [{bread,2}].

Sean Cribbs <sean at basho.com>
Developer Advocate
Basho Technologies, Inc.
http://basho.com/

On May 10, 2010, at 11:06 AM, Ted Karmel wrote:

> Hi,
> 
> I am following the Erlang Map Reduce example found here:
> https://wiki.basho.com/display/RIAK/MapReduce#MapReduce-MapReduceviatheErlangAPI
> 
> I completed the example successfully with the intended result.
> 
> But, initially, I received an unintended result when creating a
> separate object for each value:
> 
>> O0 = riak_object:new(<<"groceries">>, <<"mine">>, ["bread"]).
>> Client:put(O0, 1).
>> O1 = riak_object:new(<<"groceries">>, <<"mine">>, ["cheese"]).
>> Client:put(O1, 1).
>> O2 = riak_object:new(<<"groceries">>, <<"yours">>, ["bread"]).
>> Client:put(O2, 1).
>> O3 = riak_object:new(<<"groceries">>, <<"yours">>, ["butter"]).
>> Client:put(O3, 1).
> 
> The result was:
> 
>> [{"bread", 2}]
> 
> and not
> 
>> [{"cheese", 1}, {"bread", 2}, {"butter", 1}]
> 
> My question is WHY is there a difference?  If you enter multiple
> values via multiple objects for the same bucket and key, do the map
> reduce functions not operate over all of the values?
> 
> Any insights much appreciated.
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list