Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:19:25+00:00 2026-05-28T04:19:25+00:00

I want to execute a mapreduce query, in erlang, that contains two map phases

  • 0

I want to execute a mapreduce query, in erlang, that contains two map phases such that the Map2 function takes the result of the Map1 function as input. Is it possible and if, what must be the return value of each map phase

  • For more details:

I have run a test mapred query using two simple map functions, each one returns the input object (in a list). but by runnin the query I get a badmatch error

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}]}

I’m using riak_search-0.14.2

Erlang R14B03 (erts-5.8.4)

thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:19:25+00:00Added an answer on May 28, 2026 at 4:19 am

    I’m not sure what the signature of the Map method is in Erlang, as I’ve only done map/reduce in Javascript, but I’ll try to help.

    In order to chain the map phases, only the last map function needs to return a list of objects in Riak. Every other map function above it needs to return a tuple containing the bucket name and the key of the value passed in.

    In Javascript, I’ve accomplished this like so:

    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
      }
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two stored procedures that I want execute wrapped in a transaction. For
I want to execute a php-script from php that will use different constants and
I want to execute some mysql statements that are stored in a text file
I want to execute an SQL query like: select 'tb1'.'f1','tb1'.'f2','tb2'.'f1' from 'tb1','tb2'; Now the
I want to execute a function on all the objects within a List of
I want to execute this script (view source) that uses Google Translate AJAX API
I want to execute a sqlite query: select * from table_name where id in
I want to execute a JavaScript function every second, or whenever the time position
I want to execute a javascript that returns a string like 'GEORGE SMITH'. I
I want to execute a function when an opened child window is closed. Child

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.