Package org.apache.flink.formats.avro
Class AvroOutputFormat<E>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichOutputFormat<IT>
-
- org.apache.flink.api.common.io.FileOutputFormat<E>
-
- org.apache.flink.formats.avro.AvroOutputFormat<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.io.CleanupWhenUnsuccessful,org.apache.flink.api.common.io.InitializeOnMaster,org.apache.flink.api.common.io.OutputFormat<E>
public class AvroOutputFormat<E> extends org.apache.flink.api.common.io.FileOutputFormat<E> implements Serializable
FileOutputFormatfor Avro records.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAvroOutputFormat.CodecWrapper which encapsulates the supported codec and a related serialization byte.
-
Constructor Summary
Constructors Constructor Description AvroOutputFormat(Class<E> type)AvroOutputFormat(org.apache.flink.core.fs.Path filePath, Class<E> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected StringgetDirectoryFileName(int taskNumber)voidopen(org.apache.flink.api.common.io.OutputFormat.InitializationContext context)voidsetCodec(AvroOutputFormat.Codec codec)Set avro codec for compression.voidsetSchema(org.apache.avro.Schema schema)voidwriteRecord(E record)-
Methods inherited from class org.apache.flink.api.common.io.FileOutputFormat
configure, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError
-
-
-
-
Method Detail
-
getDirectoryFileName
protected String getDirectoryFileName(int taskNumber)
- Overrides:
getDirectoryFileNamein classorg.apache.flink.api.common.io.FileOutputFormat<E>
-
setSchema
public void setSchema(org.apache.avro.Schema schema)
-
setCodec
public void setCodec(AvroOutputFormat.Codec codec)
Set avro codec for compression.- Parameters:
codec- avro codec.
-
writeRecord
public void writeRecord(E record) throws IOException
- Specified by:
writeRecordin interfaceorg.apache.flink.api.common.io.OutputFormat<E>- Throws:
IOException
-
open
public void open(org.apache.flink.api.common.io.OutputFormat.InitializationContext context) throws IOException- Specified by:
openin interfaceorg.apache.flink.api.common.io.OutputFormat<E>- Overrides:
openin classorg.apache.flink.api.common.io.FileOutputFormat<E>- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceorg.apache.flink.api.common.io.OutputFormat<E>- Overrides:
closein classorg.apache.flink.api.common.io.FileOutputFormat<E>- Throws:
IOException
-
-