line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::Aggregator::RecordForMaximum; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = "4.0.25"; |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
2836
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
123
|
|
6
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
103
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
29
|
use App::RecordStream::Aggregator::MapReduce; |
|
5
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
88
|
|
9
|
5
|
|
|
5
|
|
22
|
use App::RecordStream::DomainLanguage::Registry; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
106
|
|
10
|
5
|
|
|
5
|
|
23
|
use App::RecordStream::DomainLanguage::Valuation::KeySpec; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
102
|
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
26
|
use base 'App::RecordStream::Aggregator::MapReduce'; |
|
5
|
|
|
|
|
22
|
|
|
5
|
|
|
|
|
2089
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
17
|
0
|
|
|
|
|
|
my $field = shift; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field)); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new_from_valuation |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
25
|
0
|
|
|
|
|
|
my ($valuation) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $this = |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'valuation' => $valuation, |
30
|
|
|
|
|
|
|
}; |
31
|
0
|
|
|
|
|
|
bless $this, $class; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $this; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub map |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
0
|
0
|
|
my ($this, $record) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $value = $this->{'valuation'}->evaluate_record($record); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return [$value, $record]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub reduce |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my ($this, $cookie1, $cookie2) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my ($v1, $r1) = @$cookie1; |
50
|
0
|
|
|
|
|
|
my ($v2, $r2) = @$cookie2; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if($v1 > $v2) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
return $cookie1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $cookie2; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub squish |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
0
|
0
|
|
my ($this, $cookie) = @_; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my ($v, $r) = @$cookie; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return $r; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub argct |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
0
|
|
return 1; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub short_usage |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
0
|
|
return "returns the record corresponding to the maximum value for a field"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub long_usage |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
0
|
0
|
|
return <
|
82
|
|
|
|
|
|
|
Usage: recformax, |
83
|
|
|
|
|
|
|
The record corresponding to the maximum value of specified field. |
84
|
|
|
|
|
|
|
EOF |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('recformax', __PACKAGE__); |
88
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('recformaximum', __PACKAGE__); |
89
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('recordformax', __PACKAGE__); |
90
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('recordformaximum', __PACKAGE__); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recformax', 'VALUATION'); |
93
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recformaximum', 'VALUATION'); |
94
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recordformax', 'VALUATION'); |
95
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recordformaximum', 'VALUATION'); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |