O - type of values produced by this outputR - type returned by finish(java.util.Collection<? extends com.google.appengine.tools.mapreduce.OutputWriter<O>>) on the supplied sinkpublic class MarshallingOutput<O,R> extends Output<O,R>
Output that marshalls records.| Constructor and Description |
|---|
MarshallingOutput(Output<ByteBuffer,R> sink,
Marshaller<O> marshaller) |
| Modifier and Type | Method and Description |
|---|---|
List<MarshallingOutputWriter<O>> |
createWriters(int numShards)
Returns a list of writers, one for each shard, for this output.
|
R |
finish(Collection<? extends OutputWriter<O>> writers)
Returns a result to be made available through
MapReduceResult.getOutputResult(). |
getContext, setContextpublic MarshallingOutput(Output<ByteBuffer,R> sink, Marshaller<O> marshaller)
public List<MarshallingOutputWriter<O>> createWriters(int numShards)
OutputcreateWriters in class Output<O,R>numShards - The number of shards which should be equal to the number of
OutputWriters returned.public R finish(Collection<? extends OutputWriter<O>> writers) throws IOException
OutputMapReduceResult.getOutputResult().
This method allows the Output to inspect the final state of its OutputWriters
to produce a final result object. For example, if the OutputWriters 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 OutputWriters 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<O,R>IOExceptionCopyright © 2015 Google. All rights reserved.