Riak mapreduce error

raghuveer sj raghuveersj at gmail.com
Mon Feb 6 22:50:01 EST 2017


Hi Magnus,

Previously i had used developer branch as master build was failing. Now
with the latest changes i see :

10> 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\\\">>,<<\\\"bar\\\">>"...>>}

Please help me out.

Regards,
Raghuveer

On Mon, Feb 6, 2017 at 9:18 PM, Magnus Kessler <mkessler at basho.com> wrote:

> On 3 February 2017 at 18:31, raghuveer sj <raghuveersj at gmail.com> wrote:
>
>> Hi Team,
>>
>> I am trying to run mapreduce in erlang.
>>
>> curl -XPUT http://localhost:8098/buckets/training/keys/foo -H
>> 'Content-Type: text/plain' -d 'caremad data goes here'
>> curl -XPUT http://localhost:8098/buckets/training/keys/bar -H
>> 'Content-Type: text/plain' -d 'caremad caremad caremad caremad'
>> curl -XPUT http://localhost:8098/buckets/training/keys/baz -H
>> 'Content-Type: text/plain' -d 'nothing to see here'
>> curl -XPUT http://localhost:8098/buckets/training/keys/bam -H
>> 'Content-Type: text/plain' -d 'caremad caremad caremad'
>>
>> *Running in erlang shell :*
>>
>> ReFun = fun(O, _, Re) -> case re:run(riak_object:get_value(O), Re,
>> [global]) of
>>     {match, Matches} -> [{riak_object:key(O), length(Matches)}];
>>     nomatch -> [{riak_object:key(O), 0}]
>> end end.
>>
>> code:which(riakc_pb_socket).
>> "./ebin/riakc_pb_socket.beam"
>>
>> {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087).
>> {ok,<0.36.0>}
>>
>> riakc_pb_socket:ping(Pid).
>> pong
>>
>> {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,...>>}}
>>
>> {ok, Riak} = riakc_pb_socket:start_link("127.0.0.1", 8087).
>> {ok,<0.42.0>}
>>
>> riakc_pb_socket:mapred_bucket(Riak, <<"training">>, [{map, {qfun,
>> ReFun}, Re, true}]).
>> ** 1: variable 'ReFun' is unbound*
>>
>> Trying to run the famous erlang sample program sample. I am stuck at this
>> error. Kindly help me out.
>>
>> Regards,
>> Raghuveer
>>
>>
> Hi Raghuveer,
>
> I have run the steps you provided, and found that they work fine for me.
> Can you let me know which version of Riak you are running this against, and
> which version of Erlang is used on the client side? Has the
> riak-erlang-client been compiled with the same Erlang version?
>
> Kind Regards,
>
> Magnus
>
> --
> Magnus Kessler
> Client Services Engineer
> Basho Technologies Limited
>
> Registered Office - 8 Lincoln’s Inn Fields London WC2A 3BP Reg 07970431
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20170207/86a9c9b5/attachment-0002.html>


More information about the riak-users mailing list