Riak mapreduce error

瘦欲@ 提交于 2019-12-24 09:54:56

问题


I am using the basic sample Riak sample provided.

5> ReFun = fun(O, _, Re) -> case re:run(riak_object:get_value(O), Re, [global]) of
5>     {match, Matches} -> [{riak_object:key(O), length(Matches)}];
5>     nomatch -> [{riak_object:key(O), 0}]
5> end end.
#Fun<erl_eval.18.50752066>
6> {ok, Re} = re:compile("caremad").
{ok,{re_pattern,0,0,0,
                <<69,82,67,80,85,0,0,0,0,0,0,0,81,0,0,0,255,255,255,255,
                  255,255,...>>}}
7> 
7> {ok, Riak} = riakc_pb_socket:start_link("127.0.0.1", 8087).
{ok,<0.44.0>}
8> riakc_pb_socket:mapred_bucket(Riak, <<"training">>, [{map, {qfun, ReFun}, Re, true}]).
{error,<<"{\"phase\":0,\"error\":\"{badfun,#Fun<erl_eval.18.50752066>}\",\"input\":\"{ok,{r_object,<<\\\"training\\\">>,<<\\\"bam\\\">>"...>>}
9> 

Looks like everything went fine except for the last step. There is no helpful information in the error except I see that the function could be syntactically wrong. I don't have any understanding of Erlang.

Update

The error I get is as follows:

curl: (3) [globbing] nested brace in column 31
The POST body was not valid JSON.
The error from the parser was:
{{badmatch,any},
 [{mochijson2,tokenize,2,[{file,"src/mochijson2.erl"},{line,574}]},
  {mochijson2,decode1,2,[{file,"src/mochijson2.erl"},{line,326}]},
  {mochijson2,json_decode,2,[{file,"src/mochijson2.erl"},{line,321}]},
  {riak_kv_mapred_json,parse_request,1,
                       [{file,"src/riak_kv_mapred_json.erl"},{line,42}]},
  {riak_kv_wm_mapred,verify_body,2,
                     [{file,"src/riak_kv_wm_mapred.erl"},{line,170}]},
  {riak_kv_wm_mapred,check_body,2,
                     [{file,"src/riak_kv_wm_mapred.erl"},{line,156}]},
  {webmachine_resource,resource_call,3,
                       [{file,"src/webmachine_resource.erl"},{line,186}]},
  {webmachine_resource,do,3,
                       [{file,"src/webmachine_resource.erl"},{line,142}]}]}

来源:https://stackoverflow.com/questions/40750284/riak-mapreduce-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!