Simple mapreduce with 2i returns different result

Russell Brown russell.brown at mac.com
Wed Apr 17 03:58:54 EDT 2013


On 17 Apr 2013, at 08:54, Mattias Sjölinder <mattias at sjolinder.se> wrote:

> Thanks for your help. Your query returned the same number over and over again just as expected. 
> 
> I think I have found the reason for my problem though. The client lib CorrugatedIron seems to wrap each document in the MapReduce result into a array turning the result into a nested array looking like:
> [[{doc1}], [{doc2}], [{doc3}]] counting 3 arrays & 3 docs
> and sometimes 
> [[{doc1}], [{doc2}, {doc3}]] counting 2 arrays and 2 docs (according to my client code... :)
> 
> Why the result for same query in CorrugatedIron and for a simple curl differs I don't know but I will investigate it further. 

My guess is the client library streams the mapreduce results and gathers the separate messages. So depending on how many chunks are sent by riak you get a different nested array of responses.

> 
> 
> Thanks again for your help!
> 
> Best regards,
> Mattias
> 
> 
> 
> 2013/4/16 Christian Dahlqvist <christian at basho.com>
> Hi Mattias,
> 
> The following curl query simply counts the number of inputs, and has worked well for me in the past. Can you please run it against the cluster a couple of times and see if it also return varying number of results?
> 
> curl -XPOST http://localhost:8098/mapred 
>   -H 'Content-Type: application/json' 
>   -d '{"inputs":{
>            "bucket":"som-bucket",
>            "index":"userid_bin",
>            "key":"18481123123"
>        },
>        "query":[{"reduce":{"language":"erlang",
>                            "module":"riak_kv_mapreduce",
>                            "function":"reduce_count_inputs"
>                            }}]}'
> 
> Best regards,
> 
> Christian
> 
> 
> 
> 
> 
> On 16 Apr 2013, at 15:52, Mattias Sjölinder <mattias at sjolinder.se> wrote:
> 
>> 18481123123
> 
> 
> _______________________________________________
> 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