Jimmy --

A couple of comments:

* Multiple sequential map phases only work if each map phase emits ONLY 
key/value pairs as the inputs for the next map phase.

* The Javascript environment provides a function, ejsLog(), which you can use 
to debug M/R jobs. You call it like this: ejsLog("/path/to/log/file", 
"StringToLog")

--Kevin
On Apr 30, 2010, at 8:37 AM, Jimmy Thrasher wrote:

> Oops.  Forgot to reply all.
> 
> Dan suggested I try keep: true in the reduce phase, but it turns out that 
> didn't make a difference.  Can anyone else spot a hole in my query below?  
> Are there logs I can look at to debug errors in the reduce phase?
> 
> Hi Dan,
> 
> Here's the query as I have it for debug purposes, including the wonky reduce 
> phase.  I might add that this query works on my local machine (Mac OS, Riak 
> 0.9.1, not Innostore).  The remote machine is Ubuntu 9.10, Amazon EC2 32-bit, 
> Innostore, Riak 0.9.1.
> 
> I'm generating the query in Ruby. Also, beware.. I'm a n00b. If this code is 
> making obvious idiomatic errors, I'd be happy to receive your suggestions.
> 
> Thanks,
> 
> Jimmy
> 
>         query = {
>           'inputs' => 'events',
>           'query' => [
>             {'map' => { # go get annotations
>               'language' => 'javascript',
>               'source' => <<-END
>                 function(v) {
>                   var d = Riak.mapValuesJson(v)[0]
>                   if (d.type == "checkin" && (#{guard_expression}))
>                     return [[v.bucket, v.key], [v.key + ',annotation', 
> 'spend']]
>                   else
>                     return []
>                 }
>               END
>               }},
>             {'map' => {
>               'language' => 'javascript',
>               'source' => # verify the annotations exist
>                 'function(v) {
>                   if ("values" in v && "bucket" in v)
>                     return [[v.bucket, v.key]]
>                   else
>                     return []
>                 }'}},
>             {'map' => { # prep for reduce phase
>               'language' => 'javascript',
>               'source' =>
>                 'function(v,k,a) {
>                   return [v]
>                 }'}},
>             {'reduce' => { # does the reduce phase work?
>               'language' => 'javascript',
>               'source' =>
>                 'function(v, a) {
>                   return v
>                 }'}},
>            ]}
> 
> On Thu, Apr 29, 2010 at 9:18 PM, Dan Reverri <reve...@gmail.com> wrote:
> What's the map phase function?
> 
> On Thu, Apr 29, 2010 at 6:14 PM, Jimmy Thrasher <ji...@groopd.com> wrote:
> Hi everyone.  Hope you're doing well.  Tried this on the IRC channel, but I 
> guess it was dinner time.  :)
> 
> I have a query which, up until today, has worked quite well.  The data 
> currently coming out of the map phases are all correct looking, but the 
> minute I start a reduce, I get [] as the result.
> 
> Currently, for debug, my only reduce function looks like this:
> function(values) {
>     return values
> }
> 
> If I remove all the reduce phases, I get, say, 2 items out of the query.  But 
> if I put that reduce function in, I get only [].
> 
> Is this something anyone has seen before?  How should I go about debugging it?
> 
> Thanks for any direction you can give.
> 
> Jimmy
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> 
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to