Skip to content

Instantly share code, notes, and snippets.

@PharkMillups
Created April 13, 2011 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PharkMillups/918603 to your computer and use it in GitHub Desktop.
Save PharkMillups/918603 to your computer and use it in GitHub Desktop.
<mjr_> If you have an object that contains a JSON array of bucket, key pairs,
can you use that as a starting point in mapred?
17:58 <aphyr> yes.
17:59 <aphyr> mjr_: you start the mapreduce phase with that object as your sole input
17:59 <aphyr> A map phase returns the list of bucket, key pairs
17:59 <aphyr> then the subsequent map phase will operate on those
18:00 <mjr_> is there some builtin function or something that fetches the contents?
18:00 <aphyr> It'd be implementation-dependent.
18:01 <aphyr> Here's a trivial one: function(v) { return JSON.parse(v.data); }
18:01 <aphyr> (if you structure your data as JSON and store a list of [bucket, key] pairs
18:01 <mjr_> So v = ["users", "mjr"];
18:02 <mjr_> Just returning that tuple returns two strings. How do I get
the contents of /riak/users/mjr in the map function?
18:02 <aphyr> v = "[[\"users\", \"mjr\"]]"
18:02 <aphyr> The input to a map phase is a list of key, value, keydata lists.
18:03 <aphyr> Er, sorry, [bucket, key, keydata]
18:03 <mjr_> ohh
18:03 <aphyr> So the next map phase would be called with the actual
data of /riak/users/mjr
18:03 <mjr_> oh, cool. That's perfect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment