File Coverage

blib/lib/App/RecordStream/Aggregator/Ord2Univariate.pm
Criterion Covered Total %
statement 21 22 95.4
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 3 0.0
total 28 33 84.8


line stmt bran cond sub pod time code
1             package App::RecordStream::Aggregator::Ord2Univariate;
2              
3             our $VERSION = "4.0.25";
4              
5 8     8   43 use strict;
  8         18  
  8         185  
6 8     8   33 use warnings;
  8         14  
  8         164  
7              
8 8     8   1127 use App::RecordStream::Aggregator::MapReduce::Field;
  8         16  
  8         179  
9 8     8   1105 use App::RecordStream::Aggregator;
  8         16  
  8         164  
10              
11 8     8   37 use base 'App::RecordStream::Aggregator::MapReduce::Field';
  8         16  
  8         1510  
12              
13             #sub new -- passed through
14              
15             #sub new_from_valuation -- passed through
16              
17             sub map_field
18             {
19 13     13 0 32 my ($this, $x) = @_;
20              
21 13         39 return [1,
22             $x,
23             $x * $x];
24             }
25              
26             sub reduce
27             {
28 9     9 0 24 my ($this, $cookie, $cookie2) = @_;
29              
30 9         20 my ($sum1_1, $sumx_1, $sumx2_1) = @$cookie;
31 9         21 my ($sum1_2, $sumx_2, $sumx2_2) = @$cookie2;
32              
33 9         36 return [$sum1_1 + $sum1_2,
34             $sumx_1 + $sumx_2,
35             $sumx2_1 + $sumx2_2];
36             }
37              
38             sub squish
39             {
40 0     0 0   die "Ord2Univariate subclass doesn't implement squish\n";
41             }
42              
43             1;