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: 
http://riak-users.197444.n3.nabble.com/Need-help-with-Mapreduce-tp3398423p3398423.html
Sent from the Riak Users mailing list archive at Nabble.com.
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to