bir necha xarita vazifalariga ega riak mapred so'rovi qanday amalga oshiriladi

Map1 funktsiyasi Map1 funktsiyasining natijasini kiritish sifatida qabul qiladigan ikkita xaritalalarni o'z ichiga olgan erlang-da, mapreduce so'rovini bajarishni xohlayman. Mumkinmi va har bir xarita fazasining qaytib kelishi qanday bo'lishi kerak

  • Qo'shimcha ma'lumot uchun:

Ikkita oddiy xarita funktsiyasidan foydalangan holda, har bir kishi kirish obyektini (ro'yxatda) ishlatib, test xarita so'rovini bajarganman. lekin so'rovni bajarish orqali, menda noto'g'ri chiziqli xato yuzaga keladi

Map1 = fun(O,_,_) -> [O] end.
Map2 = fun(O, _,_) -> [O] end.


C:mapred_bucket(<<"b7bc1418-198d-44a3-8835-8aa9cb416d5b">>, [{map, {qfun, Map1}, none, false}, {map, {qfun, Map2}, none, true}]).

{{badmatch,{r_object,<<"b7bc1418-198d-44a3-8835-8aa9cb416d5b">>,
                     <<255,230,193,167,254,7,246,64,154,190,36,236,32,232,189,
                       169,161,124,23,86>>,
                     [{r_content,{dict,2,16,16,8,80,48,
                                       {[],[],[],[],[],[],[],[],[],[],[],...},
                                       {{[],[],[],[],[],[],[],[],[],...}}},
                                 <<"12d33872-4c92-4da5-9d16-5036a8059253">>}],
                     [{<<5,215,86,61>>,{1,63487018636}}],
                     {dict,1,16,16,8,80,48,
                           {[],[],[],[],[],[],[],[],[],[],[],[],...},
                           {{[],[],[],[],[],[],[],[],[],[],...}}},
                     undefined}},
 [{riak_kv_map_phase,build_input,2},
  {riak_kv_map_phase,'-handle_input/3-lc$^0/1-0-',2},
  {riak_kv_map_phase,handle_input,3},
  {luke_phase,executing,2},
  {gen_fsm,handle_msg,7},
  {proc_lib,init_p_do_apply,3}]}

Men riak_search-0.14.2 dan foydalanmoqdaman

Erlang R14B03 (erts-5.8.4)

rahmat!

2

2 javoblar

Men Map usulining imzosi Erlang-da qanday ekanligiga ishonchim komil emas, chunki men faqat xaritani/Javascriptni qisqartirishni boshladim, ammo yordam berishga harakat qilaman.

Xarita fazalarini zanjirlash uchun faqat oxirgi xarita vazifasi Riakdagi ob'ektlar ro'yxatini qaytarishi kerak. Yuqoridagi xar bir xarita funksiyasi chelak nomini va o'tgan qiymatning kalitini o'z ichiga olgan katakchani qaytarish kerak.

Javascriptda buni shunday qildim:

function map_function(value, keydata, arg) {
    //filtering stuff here
    if(arg.last) {
      data["key"] = value.key;
      return [data];
    }
    else {
      return [[value.bucket, value.key]];
    }
    //this is in the case the filter returns true; if the filter returns false, return an empty tuple
  }

Umid qilamanki bu yordam.

5
qo'shib qo'ydi

You have to return {Bucket, Key} or {{Bucket, Key}, KeyData} from first map function.
Like this:

Map1 = fun(O,_,_) -> [{riak_object:bucket(O), riak_object:key(O)}] end.
Map2 = fun(O, _,_) -> [O] end.


C:mapred_bucket(<<"b7bc1418-198d-44a3-8835-8aa9cb416d5b">>, [{map, {qfun, Map1}, none, false}, {map, {qfun, Map2}, none, true}]).
4
qo'shib qo'ydi