Simple mapreduce with 2i returns different result

OJ Reeves oj at buffered.io
Wed Apr 17 05:18:54 EDT 2013


Hi guys,

Russell is correct. In CI we gather the responses as they come in, in
whichever order they're received. We make some effort to flatten the
result, but we take the approach of being "smart enough to get you the
results, but no smarter".

We don't do anything to reorder or manage the results in the way that the
HTTP interface does as we feel that's behaviour that the user of the
library should decide to implement should they desire it.

HTH.
OJ



On Wed, Apr 17, 2013 at 5:58 PM, Russell Brown <russell.brown at mac.com>wrote:

>
> 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
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>



-- 

OJ Reeves
+61 431 952 586
http://buffered.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130417/3cd0253f/attachment.html>


More information about the riak-users mailing list