Data-Riak
view release on metacpan or search on metacpan
lib/Data/Riak/MapReduce.pm view on Meta::CPAN
return r;
}
",
),
Data::Riak::MapReduce::Phase::Reduce->new(
language => "javascript",
source => "
function(v) {
var r = {};
for(var i in v) {
for(var w in v[i]) {
if(w in r) r[w] += v[i][w];
else r[w] = v[i][w];
}
}
return [r];
}
",
),
]
});
my $results = $mr->mapreduce;
=head1 DESCRIPTION
A map/reduce query.
=head1 ATTRIBUTES
=head2 inputs
Inputs to this query. There are few allowable forms.
For a single bucket:
inputs => "bucketname"
For a bucket and key (or many!):
inputs => [ [ "bucketname", "keyname" ] ]
inputs => [ [ "bucketname", "keyname" ], [ "bucketname", "keyname2" ] ]
And finally:
inputs => [ [ "bucketname", "keyname", "keyData" ] ]
=head2 phases
An arrayref of phases that will be executed in order. The phases should be
one of L<Data::Riak::MapReduce::Phase::Link>,
L<Data::Riak::MapReduce::Phase::Map>, or L<Data::Riak::MapReduce::Phase::Reduce>.
=head1 METHODS
=head2 mapreduce
Execute the mapreduce query.
To enable streaming, do the following:
my $results = $mr->mapreduce(chunked => 1);
=head1 AUTHORS
=over 4
=item *
Andrew Nelson <anelson at cpan.org>
=item *
Florian Ragwitz <rafl@debian.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 1.008 second using v1.01-cache-2.11-cpan-63c85eba8c4 )