Key filters + link walking

Dan Reverri dan at basho.com
Mon Mar 14 16:01:49 EDT 2011


Hi Jason,

The reduce_identity function expects a two element tuple or a two element
list; you can see this by looking at the pattern matching in the function:
https://github.com/basho/riak_kv/blob/master/src/riak_kv_mapreduce.erl#L141

A link phase returns a three element list (["bucket", "key", "tag"]). The
reduce_identity function should probably be updated to handle the output of
a phase. In the mean time you can use the reduce_set_union function instead:
{
"inputs":{
     "bucket":"bucket",
     "key_filters":[["neq", "foo"]]
  },
"query":[
{"link":{}},
{"reduce":{"language":"erlang","module":"riak_kv_mapreduce",
"function":"reduce_set_union"}}
]
}

Thanks,
Dan

Daniel Reverri
Developer Advocate
Basho Technologies, Inc.
dan at basho.com


On Mon, Mar 14, 2011 at 11:58 AM, Jason J. W. Williams <
jasonjwwilliams at gmail.com> wrote:

> No map phase. Reduce phase is the built-in "riak_kv_mapreduce",
> "reduce_identity". I really appreciate the help.
>
> -J
>
>
> On Mon, Mar 14, 2011 at 12:55 PM, Dan Reverri <dan at basho.com> wrote:
>
>> What does your map reduce query look like?
>>
>> Thanks,
>> Dan
>>
>> Daniel Reverri
>> Developer Advocate
>> Basho Technologies, Inc.
>> dan at basho.com
>>
>>
>> On Mon, Mar 14, 2011 at 11:54 AM, Jason J. W. Williams <
>> jasonjwwilliams at gmail.com> wrote:
>>
>>> The reason I ask, is when I add a link walk phase (with bucket set to the
>>> data bucket), my key filter MapReduce errors out:
>>>
>>> https://gist.github.com/869640
>>>
>>> The key filters are:
>>>
>>> ["urldecode"],
>>> ["tokenize", "/", "2],
>>> ["eq", "test!"]
>>>
>>> Any help is greatly appreciated.
>>>
>>> -J
>>>
>>>
>>> On Mon, Mar 14, 2011 at 12:34 PM, Dan Reverri <dan at basho.com> wrote:
>>>
>>>> Hi Jason,
>>>>
>>>> Yes, a link phase can be used after a key filter.
>>>>
>>>> Thanks,
>>>> Dan
>>>>
>>>> Daniel Reverri
>>>> Developer Advocate
>>>> Basho Technologies, Inc.
>>>> dan at basho.com
>>>>
>>>>
>>>> On Wed, Mar 9, 2011 at 5:34 PM, Jason J. W. Williams <
>>>> jasonjwwilliams at gmail.com> wrote:
>>>>
>>>>> Is it possible to add a link phase when using key filters? Currently,
>>>>> just using key filters combined with a reduce phase (built-in reduce
>>>>> identity). Would like to add a link phase to pull all the linked keys
>>>>> and pass them to the identity reduce as well. Thank you in advance.
>>>>>
>>>>> -J
>>>>>
>>>>> _______________________________________________
>>>>> riak-users mailing list
>>>>> riak-users at lists.basho.com
>>>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>>>
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110314/ead97dde/attachment.html>


More information about the riak-users mailing list