erlang - How to get binary data into integer on mapreduce in riak -
i working on riak-erlang client ,
i have done following...
3> mapf = fun(obj,_,_) -> [riak_object:get_value(obj)] end. #fun<erl_eval.18.82930912> 4> 4> {ok, [{0,[r]}]} = riakc_pb_socket:mapred(pid,<<"tst">>, [{map{qfun,mapf},none,true}]). ** exception error: no match of right hand side value {ok,[{0,[<<"2">>,<<"4">>,<<"6">>,<<"3">>,<<"5">>,<<"1">>]}]}
how solve issue
and how solve these kind of issue
{ok, [{0,[s]}]} = riakc_pb_socket:mapred(pid,<<"test">>,[{map, {qfun,maps},none,true}]). ** exception error: no match of right hand side value {ok,[{0, [<<"{\"age\": 24, \"name\": \"krishna\"}">>, <<"{\"age\": 29, \"name\": \"sharat\"}">>, <<"{\"age\": 27, \"name\": \"anil\"}">>, <<"{\"age\": 28, \"name\": \"kumar\"}">>, <<"{\"age\": 24, \"name\": \"gopi\"}">>, <<"{\"age\": 25, \"name\": \"ramesh\"}">>]}]}
if want age , age even. how write map function.
you have pattern matching issues. try both times match list using [r] = [<<data…>>,…]
.
[r]
matches 1-element list, element being r
.
need remove brackets match whole data structure, so: {ok, [{0,r}]
.
Comments
Post a Comment