You're also missing a comma between your map and reduce phases.

On Wed, Oct 5, 2011 at 8:23 PM, Aphyr <ap...@aphyr.com> wrote:

> Like it says, the request that you submitted isn't JSON. MR functions
> belong in the source attribute of the JSON document, not floating outside
> it.
>
> --Kyle
>
>
> On 10/05/2011 05:19 PM, urvi wrote:
>
>> I am trying to use this fuctntion to get the highest number from given
>> date. My map is working fine but reduce function is giving me error.
>> Please help me
>>
>> curl -X POST http://x:8098/mapred -H "Content-Type: application/json" -d
>> @-
>> function(value, keyData, arg){
>> var data = Riak.map.ValuesJson(value) [0];
>> return [data.High];
>> }
>>
>> {"inputs":[["symc","2011-10-**04"],
>> ["symc","2011-09-02"],
>> ["symc","2011-10-03"]],
>> "query":[{"map":{"language":"**javascript",
>> "source":"function(value, keyData, arg) { var data =
>> Riak.mapValuesJson(value)[0]; return [data.High];}"
>> }}
>> {"reduce":{"language":"**javascript","name":"Riak.**
>> reduceMax","keep":true}}]
>> }
>> --Ctrl-D to submit it
>>
>> Output :
>>
>> The POST body was not valid JSON.
>> The error from the parser was:
>> {{case_clause,<<"function(**value, keyData, arg){ var data =
>> Riak.map.ValuesJson(value) [0]; return
>> [data.High];}{\"inputs\":[[\"**symc\",\"2011-10-04\"],
>> [\"symc\",\"2011-09-02\"], [\"symc\",\"2011-10-03\"]],
>> \"query\":[{\"map\":{\"**language\":\"javascript\",
>> \"source\":\"function(value, keyData, arg) { var data =
>> Riak.mapValuesJson(value)[0]; return [data.High];}\" }}
>> {\"reduce\":{\"language\":\"**javascript\",\"name\":\"Riak.**
>> reduceMax\",\"keep\":true}}]}"**>>},
>> [{mochijson2,tokenize,2},
>> {mochijson2,decode1,2},
>> {mochijson2,json_decode,2},
>> {riak_kv_mapred_json,parse_**request,1},
>> {riak_kv_wm_mapred,verify_**body,2},
>> {riak_kv_wm_mapred,malformed_**request,2},
>> {webmachine_resource,resource_**call,3},
>> {webmachine_resource,do,3}]}
>>
>>
>> ------------------------------**------------------------------**
>> ------------
>>
>> View this message in context: Need help with Mapreduce
>> <http://riak-users.197444.n3.**nabble.com/Need-help-with-**
>> Mapreduce-tp3398423p3398423.**html<http://riak-users.197444.n3.nabble.com/Need-help-with-Mapreduce-tp3398423p3398423.html>
>> >
>>
>> Sent from the Riak Users mailing list archive
>> <http://riak-users.197444.n3.**nabble.com/<http://riak-users.197444.n3.nabble.com/>>
>> at Nabble.com.
>>
>>
>>
>> ______________________________**_________________
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/**mailman/listinfo/riak-users_**lists.basho.com<http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com>
>>
>
> ______________________________**_________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/**mailman/listinfo/riak-users_**lists.basho.com<http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com>
>



-- 
Sean Cribbs <s...@basho.com>
Developer Advocate
Basho Technologies, Inc.
http://www.basho.com/
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to