public class GoogleCloudStorageMergeOutput extends Output<KeyValue<ByteBuffer,List<ByteBuffer>>,FilesByShard>
Constructor and Description |
---|
GoogleCloudStorageMergeOutput(String bucket,
String mrJobId,
Integer tier) |
Modifier and Type | Method and Description |
---|---|
List<? extends OutputWriter<KeyValue<ByteBuffer,List<ByteBuffer>>>> |
createWriters(int shards)
Returns a writer that writes the data the same way that the sort does, splitting the output
every time the key goes backwards in sequence.
|
FilesByShard |
finish(Collection<? extends OutputWriter<KeyValue<ByteBuffer,List<ByteBuffer>>>> writers)
Returns a result to be made available through
MapReduceResult.getOutputResult() . |
getContext, setContext
public List<? extends OutputWriter<KeyValue<ByteBuffer,List<ByteBuffer>>>> createWriters(int shards)
GoogleCloudStorageMergeInput
to convert a large number of sorted files into a much
smaller number of sorted files.createWriters
in class Output<KeyValue<ByteBuffer,List<ByteBuffer>>,FilesByShard>
shards
- The number of shards which should be equal to the number of
OutputWriter
s returned.public FilesByShard finish(Collection<? extends OutputWriter<KeyValue<ByteBuffer,List<ByteBuffer>>>> writers)
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<ByteBuffer,List<ByteBuffer>>,FilesByShard>
Copyright © 2015 Google. All rights reserved.