line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hadoop::Streaming::Reducer::Input::Iterator; |
2
|
|
|
|
|
|
|
$Hadoop::Streaming::Reducer::Input::Iterator::VERSION = '0.143060'; |
3
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
4
|
1
|
|
|
1
|
|
675
|
use Safe::Isa; |
|
1
|
|
|
|
|
440
|
|
|
1
|
|
|
|
|
123
|
|
5
|
|
|
|
|
|
|
with 'Hadoop::Streaming::Role::Iterator'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
360
|
use Hadoop::Streaming::Reducer::Input::ValuesIterator; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
257
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#ABSTRACT: Collects values for each key together with an iterator interface |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has input => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => sub { |
14
|
|
|
|
|
|
|
die 'not a Hadoop::Streaming::Reducer::Input object' |
15
|
|
|
|
|
|
|
unless $_[0]->$_isa('Hadoop::Streaming::Reducer::Input'); |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has current_key => ( |
21
|
|
|
|
|
|
|
is => 'rw', |
22
|
|
|
|
|
|
|
does => 'Str' |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub has_next { |
27
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
28
|
0
|
0
|
|
|
|
|
return if not defined $self->input->next_key; |
29
|
0
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub next { |
34
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( not defined $self->current_key ) { |
37
|
0
|
|
|
|
|
|
$self->current_key($self->input->next_key); |
38
|
0
|
|
|
|
|
|
return $self->retval( $self->current_key ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if ($self->current_key ne $self->input->next_key) { |
42
|
0
|
|
|
|
|
|
$self->current_key($self->input->next_key); |
43
|
0
|
|
|
|
|
|
return $self->retval( $self->current_key ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my ($key, $value); |
47
|
0
|
|
|
|
|
|
do { |
48
|
0
|
0
|
|
|
|
|
($key, $value) = $self->input->each or return; |
49
|
|
|
|
|
|
|
} while ($self->current_key eq $key); |
50
|
0
|
|
|
|
|
|
$self->current_key( $key ); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return $self->retval($key, $value); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub retval { |
57
|
0
|
|
|
0
|
1
|
|
my ($self, $key, $value) = @_; |
58
|
|
|
|
|
|
|
return ( |
59
|
0
|
|
|
|
|
|
$key, |
60
|
|
|
|
|
|
|
Hadoop::Streaming::Reducer::Input::ValuesIterator->new( |
61
|
|
|
|
|
|
|
input_iter => $self, |
62
|
|
|
|
|
|
|
first => $value, |
63
|
|
|
|
|
|
|
), |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |