« blib/lib/App/RecordStream/Deaggregator/Split.pm
↑ Summary
blib/lib/App/RecordStream/Executor/Getopt.pm »
| 1 | package App::RecordStream::Aggregator::MapReduce; | ||||||||||
| 2 | |||||||||||
| 3 | 17 | our $VERSION = "4.0.23"; | |||||||||
| 4 | |||||||||||
| 5 | 17 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 17 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 17 | ▶ | use base qw(App::RecordStream::Aggregator::Aggregation); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | sub new | ||||||||||
| 11 | { | ||||||||||
| 12 | 28 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | |||||||||||
| 14 | 28 | my $this = { }; | |||||||||
| 15 | 28 | bless $this, $class; | |||||||||
| 16 | |||||||||||
| 17 | 28 | return $this; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | sub initial | ||||||||||
| 21 | { | ||||||||||
| 22 | 134 | ▶ | return undef; | ||||||||
|
Subroutine
initial: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub combine | ||||||||||
| 26 | { | ||||||||||
| 27 | 430 | ▶ | my ($this, $cookie, $record) = @_; | ||||||||
|
Subroutine
combine: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 28 | |||||||||||
| 29 | 430 | my $cookie2 = $this->map($record); | |||||||||
| 30 | |||||||||||
| 31 | # treat undef on either side as empty and return the other | ||||||||||
| 32 | 430 | ▶ | if(!defined($cookie)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | { | ||||||||||
| 34 | 137 | return $cookie2; | |||||||||
| 35 | } | ||||||||||
| 36 | 293 | ▶ | if(!defined($cookie2)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | { | ||||||||||
| 38 | 0 | return $cookie; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | # if they're both non-undef then combine them | ||||||||||
| 42 | 293 | return $this->reduce($cookie, $cookie2); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub squish | ||||||||||
| 46 | { | ||||||||||
| 47 | 104 | ▶ | my ($this, $cookie) = @_; | ||||||||
|
Subroutine
squish: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 48 | |||||||||||
| 49 | 104 | return $cookie; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | sub map | ||||||||||
| 53 | { | ||||||||||
| 54 | 0 | ▶ | die "MapReduce subclass did not implement map.\n"; | ||||||||
|
Subroutine
map: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub reduce | ||||||||||
| 58 | { | ||||||||||
| 59 | 0 | ▶ | die "MapReduce subclass did not implement reduce.\n"; | ||||||||
|
Subroutine
reduce: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 17 | 1; | |||||||||