org.apache.crunch.materialize.pobject
Class MapPObject<K,V>
java.lang.Object
org.apache.crunch.materialize.pobject.PObjectImpl<Pair<K,V>,Map<K,V>>
org.apache.crunch.materialize.pobject.MapPObject<K,V>
- Type Parameters:
K
- The type of keys for the Map.V
- The type of values for the Map.
- All Implemented Interfaces:
- PObject<Map<K,V>>
public class MapPObject<K,V>
- extends PObjectImpl<Pair<K,V>,Map<K,V>>
A concrete implementation of PObjectImpl
whose
value is a Java Map
. The underlying PCollection
for this
PObject
must contain Pair
s of values. The
first element of the pair will be used as the map key, while the second element will be used
as the map value. Note that the contents of the underlying PCollection
may not be
reflected in the returned Map
, since a single key may be mapped to several values in
the underlying PCollection
, and only one of those values will appear in the Map
encapsulated by this PObject
.
MapPObject
public MapPObject(PCollection<Pair<K,V>> collect)
- Constructs a new instance of this
PObject
implementation.
- Parameters:
collect
- The backing PCollection
for this PObject
.
process
public Map<K,V> process(Iterable<Pair<K,V>> input)
- Transforms the provided Iterable, obtained from the backing
PCollection
,
into the value encapsulated by this PObject
.
- Specified by:
process
in class PObjectImpl<Pair<K,V>,Map<K,V>>
- Parameters:
input
- An Iterable whose elements correspond to those of the backing PCollection
.
- Returns:
- The value of this
PObject
.
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.