Hadoop::Streaming::Reducer::Input::ValuesIterator - Role providing access to values for a given key.


Hadoop-Streaming documentation Contained in the Hadoop-Streaming distribution.

Index


Code Index:

NAME

Top

Hadoop::Streaming::Reducer::Input::ValuesIterator - Role providing access to values for a given key.

VERSION

Top

version 0.110030

METHODS

Top

has_next

    $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.

next

    $ValuesIterator->next();

Returns the next value available. Reads from $ValuesIterator->input_iter->input

AUTHORS

Top

COPYRIGHT AND LICENSE

Top


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__