Ping: Using Erlang funs for map reduce via the REST API and protocol buffers client

Seth Falcon seth at userprimary.net
Wed Oct 6 15:52:18 EDT 2010


Hey all,

I have a patch that allows you to specify Erlang funs as strings for
use in map/reduce via both the REST and protocol buffer APIs.  So you
can do things like:

## For REST

{"reduce":{"language":"erlang",
                "source":"
fun(ValueList, _Arg) ->
  [lists:foldl(fun erlang:'+'/2, 0, ValueList)]
end.",
"keep":true}}

## For pb

Mapper = "fun(G, _X, _Y) ->
  O = riak_object:get_value(G),
  [proplists:get_value(blah, O)]
 end.".

riakc_pb_socket:mapred(Pid, Input, [{map, {strfun, Mapper}, unset, true}]).


I posted a note about this to the list a month ago, but haven't
received any response.  Curious if this is of interest to other users.
Basho team, comments?

Link to original post:
http://lists.basho.com/pipermail/riak-users_lists.basho.com/2010-September/001918.html

Thanks,

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/




More information about the riak-users mailing list