Hello,

Could you please shed light on howto use strfun type in mapred query?

As I see, strfun was introduces as a solution for inability to use anonymous 
functions in Erlang mapred syntax  
(http://lists.basho.com/pipermail/riak-users_lists.basho.com/2010-September/001918.html).
I have tried the following code:

{ok, C} = riak:client_connect('[email protected]').
MapFun = "fun(Input, undefined, none) -> [{BinData, ObjStatus} || {BinData, 
ObjStatus} <- [riak_object:get_value(Input)], ObjStatus == 1] end.".
C:mapred(<<"test_bucket">>, [{map, {strfun, MapFun}, none, true}]).

But with no luck.
I got on Riak cluster:
[error] gen_fsm <0.30923.28> in state executing terminated with reason: 
{error,{error,{badfun,#Fun<erl_eval.18.82930912>},[{riak_kv_mapper,run_map,9},{riak_kv_mapper,'-do_map/2-fun-0-',9},{lists,foldl,3},{riak_kv_mapper,do_map,2},{gen_fsm,handle_msg,7},{proc_lib,init_p_do_apply,3}]}}
[error] CRASH REPORT Process <0.30923.28> with 0 neighbours crashed with 
reason: 
{error,{error,{badfun,#Fun<erl_eval.18.82930912>},[{riak_kv_mapper,run_map,9},{riak_kv_mapper,'-do_map/2-fun-0-',9},{lists,foldl,3},{riak_kv_mapper,do_map,2},{gen_fsm,handle_msg,7},{proc_lib,init_p_do_apply,3}]}}
[error] Supervisor luke_phase_sup had child undefined started with 
{luke_phase,start_link,undefined} at <0.30923.28> exit with reason 
{error,{error,{badfun,#Fun<erl_eval.18.82930912>},[{riak_kv_mapper,run_map,9},{riak_kv_mapper,'-do_map/2-fun-0-',9},{lists,foldl,3},{riak_kv_mapper,do_map,2},{gen_fsm,handle_msg,7},{proc_lib,init_p_do_apply,3}]}}
 in context child_terminated

Please, advice.

PS. I use 3 node cluster, and my client runs on separate machine. I have tried 
the code above with local_client on riak node and it works well.

Regards,
Boris

_______________________________________________________

The information contained in this message may be privileged and conf idential 
and protected from disclosure. If you are not the original intended recipient, 
you are hereby notified that any review, retransmission, dissemination, or 
other use of, or taking of any action in reliance upon, this information is 
prohibited. If you have received this communication in error, please notify the 
sender immediately by replying to this message and delete it from your 
computer. Thank you for your cooperation. Troika Dialog, Russia. 
If you need assistance please contact our Contact Center  (+7495) 258 0500 or 
go to www.troika.ru/eng/Contacts/system.wbp  

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to