blib/lib/App/RecordStream/Aggregator/MapReduce.pm

filter: Statementstmt 88.8% 24 / 27 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 6 totaltotal 73.9% 34 / 46 CC 3 SCAR 5.6
CC
3
Cov
87%
combine
3.1
map
2.0
reduce
2.0
CRAP 1.7
« 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.25";
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 28 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
12 28 my $class = shift;
13  
14 28 my $this = { };
15 28 bless $this, $class;
16  
17 28 return $this;
18 }
19  
20 sub initial
21 137 ▶{
Subroutine initial: called CC=1 SCAR=0.0
Pod undocumented
22 137 return undef;
23 }
24  
25 sub combine
26 437 ▶{
Subroutine combine: called CC=3 SCAR=11.2
Pod undocumented
27 437 my ($this, $cookie, $record) = @_;
28  
29 437 my $cookie2 = $this->map($record);
30  
31 # treat undef on either side as empty and return the other
32 437 ▶ if(!defined($cookie))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cookie) 140 297 437
33 {
34 140 return $cookie2;
35 }
36 297 ▶ if(!defined($cookie2))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cookie2) 0 297 297
37 {
38 0 return $cookie;
39 }
40  
41 # if they're both non-undef then combine them
42 297 return $this->reduce($cookie, $cookie2);
43 }
44  
45 sub squish
46 107 ▶{
Subroutine squish: called CC=1 SCAR=0.0
Pod undocumented
47 107 my ($this, $cookie) = @_;
48  
49 107 return $cookie;
50 }
51  
52 sub map
53 0 ▶{
Subroutine map: not called CC=1 SCAR=6.9
Pod undocumented
54 0 die "MapReduce subclass did not implement map.\n";
55 }
56  
57 sub reduce
58 0 ▶{
Subroutine reduce: not called CC=1 SCAR=6.9
Pod undocumented
59 0 die "MapReduce subclass did not implement reduce.\n";
60 }
61  
62 17 1;
« blib/lib/App/RecordStream/Deaggregator/Split.pm ↑ Summary blib/lib/App/RecordStream/Executor/Getopt.pm »