E
- public class AvroOutputFormat<E> extends FileOutputFormat<E> implements Serializable
FileOutputFormat
for Avro records.Modifier and Type | Class and Description |
---|---|
static class |
AvroOutputFormat.Codec
Wrapper which encapsulates the supported codec and a related serialization byte.
|
FileOutputFormat.OutputDirectoryMode
FILE_PARAMETER_KEY, outputFilePath, stream
Constructor and Description |
---|
AvroOutputFormat(Class<E> type) |
AvroOutputFormat(Path filePath,
Class<E> type) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Method that marks the end of the life-cycle of parallel output instance.
|
protected String |
getDirectoryFileName(int taskNumber) |
void |
open(int taskNumber,
int numTasks)
Opens a parallel instance of the output format to store the result of its parallel instance.
|
void |
setCodec(AvroOutputFormat.Codec codec)
Set avro codec for compression.
|
void |
setSchema(org.apache.avro.Schema schema) |
void |
writeRecord(E record)
Adds a record to the output.
|
configure, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError
getRuntimeContext, setRuntimeContext
protected String getDirectoryFileName(int taskNumber)
getDirectoryFileName
in class FileOutputFormat<E>
public void setSchema(org.apache.avro.Schema schema)
public void setCodec(AvroOutputFormat.Codec codec)
codec
- avro codec.public void writeRecord(E record) throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be opened.
writeRecord
in interface OutputFormat<E>
record
- The records to add to the output.IOException
- Thrown, if the records could not be added to to an I/O problem.public void open(int taskNumber, int numTasks) throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be configured.
open
in interface OutputFormat<E>
open
in class FileOutputFormat<E>
taskNumber
- The number of the parallel instance.numTasks
- The number of parallel tasks.IOException
- Thrown, if the output could not be opened due to an I/O problem.public void close() throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be opened.
close
in interface OutputFormat<E>
close
in class FileOutputFormat<E>
IOException
- Thrown, if the input could not be closed properly.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.