K
- type of intermediate keysV
- type of intermediate valuespublic class GoogleCloudStorageMapOutput<K,V> extends Output<KeyValue<K,V>,FilesByShard>
Output
that is used for the map stage.
This consists of a number of GCS files where the content is split up by the provided
Sharder
.Constructor and Description |
---|
GoogleCloudStorageMapOutput(String bucket,
String mrJobId,
Marshaller<K> keyMarshaller,
Marshaller<V> valueMarshaller,
Sharder sharder) |
Modifier and Type | Method and Description |
---|---|
List<? extends OutputWriter<KeyValue<K,V>>> |
createWriters(int shards)
Returns a list of writers, one for each shard, for this output.
|
FilesByShard |
finish(Collection<? extends OutputWriter<KeyValue<K,V>>> outputWriters)
Returns a result to be made available through
MapReduceResult.getOutputResult() . |
getContext, setContext
public GoogleCloudStorageMapOutput(String bucket, String mrJobId, Marshaller<K> keyMarshaller, Marshaller<V> valueMarshaller, Sharder sharder)
public List<? extends OutputWriter<KeyValue<K,V>>> createWriters(int shards)
Output
createWriters
in class Output<KeyValue<K,V>,FilesByShard>
shards
- The number of shards which should be equal to the number of
OutputWriter
s returned.public FilesByShard finish(Collection<? extends OutputWriter<KeyValue<K,V>>> outputWriters) throws IOException
Output
MapReduceResult.getOutputResult()
.
This method allows the Output
to inspect the final state of its OutputWriter
s
to produce a final result object. For example, if the OutputWriter
s produce blobs in
blobstore, finish
could collect and return a list of blob IDs.
Should return null if no such result makes sense for this kind of output.
Called after all OutputWriter
s have been closed (with OutputWriter.close()
). It
is possible for this method to be called more than once with the same writers
collection. It is also possible for the job to fail after this is invoked.
The writers
argument will contain the same writers that Output.createWriters(int)
returned
in the same order. Writers may be serialized and deserialized multiple times. typically,
getWriter
will have been called in a different JVM.
finish
in class Output<KeyValue<K,V>,FilesByShard>
IOException
Copyright © 2015 Google. All rights reserved.