| Hadoop-Streaming documentation | Contained in the Hadoop-Streaming distribution. |
Hadoop::Streaming::Reducer::Input::ValuesIterator - Role providing access to values for a given key.
version 0.110030
$ValuesIterator->has_next();
Checks if the ValueIterator has another value available for this key.
Returns 1 on success, 0 if the next value is from another key, and undef if there is no next key.
$ValuesIterator->next();
Returns the next value available. Reads from $ValuesIterator->input_iter->input
This software is copyright (c) 2011 by Naoya Ito <naoya@hatena.ne.jp>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Hadoop-Streaming documentation | Contained in the Hadoop-Streaming distribution. |
package Hadoop::Streaming::Reducer::Input::ValuesIterator; BEGIN { $Hadoop::Streaming::Reducer::Input::ValuesIterator::VERSION = '0.110030'; } use Moose; with 'Hadoop::Streaming::Role::Iterator'; #ABSTRACT: Role providing access to values for a given key. has input_iter => ( is => 'ro', does => 'Hadoop::Streaming::Role::Iterator', required => 1, ); has first => ( is => 'rw', ); sub has_next { my $self = shift; return 1 if $self->first; return unless defined $self->input_iter->input->next_key; return $self->input_iter->current_key eq $self->input_iter->input->next_key ? 1 : 0; } sub next { my $self = shift; if ( my $first = $self->first ) { $self->first(undef); return $first; } my ( $key, $value ) = $self->input_iter->input->each; $value; } __PACKAGE__->meta->make_immutable; 1; __END__