Hi Brendan, Anonymous Erlang functions are not currently supported in map reduce phases. Is this a feature the community would find valuable?
Thanks, Dan Daniel Reverri Developer Advocate Basho Technologies, Inc. [email protected] On Mon, Jan 24, 2011 at 12:14 PM, Brendan <[email protected]> wrote: > is it possible to pass erlang anonymous funs via the REST API? i took a > javascript query, replaced "language":"javascript" with > "language":"erlang" and changed the source to an anonymous fun, but i > end up getting an error from the REST API back.am i doing something > wrong here, or can erlang functions only be called using the "module" > and "function" fields? > > the anonymous erlang fun was pulled from the Phase Functions->Map > Function examples section of the http://wiki.basho.com/MapReduce.html > wiki page. > > [dev.a]brendan@build01:~/riak$ curl -X PUT -d 'stuff' > http://127.0.0.1:8098/riak/bucket/object > [dev.a]brendan@build01:~/riak$ curl -X GET > http://127.0.0.1:8098/riak/bucket/object; echo > stuff > [dev.a]brendan@build01:~/riak$ cat erl2 > { > "inputs": [ > [ > "bucket", > "object" > ] > ], > "query": [ > { > "map": { > "language": "erlang", > "source": > "fun(Value,_Keydata,_Arg)->[[riak_object:get_value(Value)]] end." > } > } > ] > } > [dev.a]brendan@build01:~/riak$ curl -X POST -H > "content-type:application/json" http://localhost:8098/mapred --data @erl2 > <html><head><title>500 Internal Server > Error</title></head><body><h1>Internal Server Error</h1>The server > encountered an error while processing this request:<br><pre>{error,badarg, > [{erlang,binary_to_list,[undefined]}, > {riak_kv_mapred_json,bin_to_atom,1}, > {riak_kv_mapred_json,parse_step,2}, > {riak_kv_mapred_json,parse_query,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}]}</pre><P><HR><ADDRESS>mochiweb+webmachine > web server</ADDRESS></body></html> > > > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
