mapreduce

francisco treacy francisco.treacy at gmail.com
Wed Nov 10 14:05:31 EST 2010


What version of Riak are you using?

I tried it on 0.13, and I get [] as a result.

Not sure what happens when you don't return though. I would've written:

function(value, keyData, arg){var data =
Riak.mapValuesJson(value)[0];if(data.expires === 0){return
[value.key]} else { return [] } }


2010/11/9 Andrea Campolonghi <acampolonghi at gmail.com>:
> Thanks Kevin.
> I am testing in this way and I submit this:
>
> {
>
>   "inputs": "bucket",
>
>   "query": [
>
>      {
>
>       "map": {
>
>         "language": "javascript",
>
>         "source": "function(value, keyData, arg){var data =
> Riak.mapValuesJson(value)[0];if(data.expires == 0){return [value.key];}}",
>
> "keep":true
>
>       }
>
>     }
>
>   ]
>
> }
>
> As result I get a generic error like :
>
> {"lineno":483,"message":"JSON.parse","source":"unknown"}
>
> I am having hard time to find a way to debug this.
>
> Any suggestion?
>
> Thanks
>
> Andrea
>
> 2010/11/9 Kevin Smith <ksmith at basho.com>
>>
>> That is the JSON format for a MapReduce job. You need to POST it to the
>> mapred end point like so:
>>
>> curl -XPOST -H"content-type=application/json" -d -
>> http://localhost:8098/mapred
>>
>> --Kevin
>> On Nov 9, 2010, at 5:54 AM, Andrea Campolonghi wrote:
>>
>> > I am testing the riak mapreduce syntax.
>> >
>> > I am using the default bucket and I am sure I have something inside in
>> > json format.
>> >
>> > curl -v GET http://localhost:8098/riak/bucket/susi
>> >
>> > get me back :
>> >
>> >
>> > {"idleTime":0,"expires":0,"timeIdle":0,"created":1289247328234,"hits":0,"lastModified":1289247328234,"exprires":1289247328234,"value":"'Susanne'","lifeSpan":0}
>> >
>> > Now When I try to run this from the riak console I do  not get any
>> > result:
>> >
>> >
>> > {"input":"bucket","query":[{"map":{"language":"javascript","source":"function(v)
>> > { return [v]; }","keep":true}}]};
>> >
>> > Any suggestion?
>> >
>> > Thanks
>> >
>> > --
>> > Andrea Campolonghi
>> >
>> > Cell : +39 347 2298435
>> > andrea at andreacfm.com
>> > http://www.andreacfm.com
>> >
>> > Railo Team
>> > andrea at getrailo.org
>> > http://getrailo.org
>> >
>> >
>> > _______________________________________________
>> > riak-users mailing list
>> > riak-users at lists.basho.com
>> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>
>
>
> --
> Andrea Campolonghi
>
> Cell : +39 347 2298435
> andrea at andreacfm.com
> http://www.andreacfm.com
>
> Railo Team
> andrea at getrailo.org
> http://getrailo.org
>
>
>
> _______________________________________________
> 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