| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::RecordStream::Aggregator::MapReduce; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = "4.0.24"; |
|
4
|
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
95
|
use strict; |
|
|
16
|
|
|
|
|
35
|
|
|
|
16
|
|
|
|
|
401
|
|
|
6
|
16
|
|
|
16
|
|
85
|
use warnings; |
|
|
16
|
|
|
|
|
34
|
|
|
|
16
|
|
|
|
|
462
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
|
124
|
use base qw(App::RecordStream::Aggregator::Aggregation); |
|
|
16
|
|
|
|
|
41
|
|
|
|
16
|
|
|
|
|
4755
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
28
|
|
|
28
|
0
|
150
|
my $class = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
28
|
|
|
|
|
60
|
my $this = { }; |
|
15
|
28
|
|
|
|
|
84
|
bless $this, $class; |
|
16
|
|
|
|
|
|
|
|
|
17
|
28
|
|
|
|
|
128
|
return $this; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub initial |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
137
|
|
|
137
|
0
|
974
|
return undef; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub combine |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
437
|
|
|
437
|
0
|
1037
|
my ($this, $cookie, $record) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
437
|
|
|
|
|
1613
|
my $cookie2 = $this->map($record); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# treat undef on either side as empty and return the other |
|
32
|
437
|
100
|
|
|
|
1324
|
if(!defined($cookie)) |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
140
|
|
|
|
|
543
|
return $cookie2; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
297
|
50
|
|
|
|
676
|
if(!defined($cookie2)) |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
0
|
|
|
|
|
0
|
return $cookie; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# if they're both non-undef then combine them |
|
42
|
297
|
|
|
|
|
894
|
return $this->reduce($cookie, $cookie2); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub squish |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
107
|
|
|
107
|
0
|
276
|
my ($this, $cookie) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
107
|
|
|
|
|
306
|
return $cookie; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub map |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
0
|
|
|
0
|
0
|
|
die "MapReduce subclass did not implement map.\n"; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub reduce |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
0
|
|
die "MapReduce subclass did not implement reduce.\n"; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |