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.24";
4              
5 8     8   48 use strict;
  8         17  
  8         205  
6 8     8   44 use warnings;
  8         16  
  8         210  
7              
8 8     8   2718 use App::RecordStream::Aggregator::MapReduce::Field;
  8         22  
  8         197  
9 8     8   863 use App::RecordStream::Aggregator;
  8         20  
  8         194  
10              
11 8     8   47 use base 'App::RecordStream::Aggregator::MapReduce::Field';
  8         19  
  8         1365  
12              
13             #sub new -- passed through
14              
15             #sub new_from_valuation -- passed through
16              
17             sub map_field
18             {
19 13     13 0 36 my ($this, $x) = @_;
20              
21 13         50 return [1,
22             $x,
23             $x * $x];
24             }
25              
26             sub reduce
27             {
28 9     9 0 23 my ($this, $cookie, $cookie2) = @_;
29              
30 9         23 my ($sum1_1, $sumx_1, $sumx2_1) = @$cookie;
31 9         21 my ($sum1_2, $sumx_2, $sumx2_2) = @$cookie2;
32              
33 9         45 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;