CRDT-map usage in erlang mapreduce via HTTP

Russell Brown russell.brown at
Tue Jan 6 06:17:46 EST 2015

Hi Cezary,
The keys in a map are pairs, {FieldName, FieldType}, and when map reducing they haven’t been through the API layer to make the module names friendly, so rather than {my_name, set} you have {may_name, riak_dt_orswot}.

For example

    M = riak_kv_crdt:map_value(V).


is a map with two fields, a map and a set. The map field is called {<<“m1”>>, riak_dt_map}. So to access it:

   prop lists:get_value({<<“m1”>>, riak_dt_orswot}, M).

And likewise to access the set values.

It would be helpful, I agree, if we added something like Bob Ippolito’s KVC[1] for Map reduce access to Map values. Please raise an issue against riak[2] as a feature request if you would like this for a future version.

riak_dt[3] (the library whose data types riak uses) is a purely functional library with no dependencies, so it is easy to play around on the console to help you write your map reduce functions before deploying them.

Hope that helps


[1] KVC -
[2] Riak -
[3] riak dt -

On 4 Jan 2015, at 21:12, Cezary Kosko <koskocezarym at> wrote:

> Hi,
> I wanted to ask how you use a map data type in mapreduce. Calling riak_kv_crdt:map_value/1 seems to be but the start, I can't seem to be able to extract particular values - proplists:get_value/2 returns undefined for virtually every possible input, so right now I've localized the keys' index in proplists:get_keys/1's output and am calling proplists:get_value(lists:nth(_whatever_index_, proplists:get_keys(MapValue)), MapValue), but that's as bad as it gets.
> Kind regards,
> Cezary
> _______________________________________________
> riak-users mailing list
> riak-users at

More information about the riak-users mailing list