Class 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
    FileOutputFormat for Avro records.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AvroOutputFormat.Codec
      Wrapper which encapsulates the supported codec and a related serialization byte.
      • Nested classes/interfaces inherited from class org.apache.flink.api.common.io.FileOutputFormat

        org.apache.flink.api.common.io.FileOutputFormat.OutputDirectoryMode
      • Nested classes/interfaces inherited from interface org.apache.flink.api.common.io.OutputFormat

        org.apache.flink.api.common.io.OutputFormat.InitializationContext
    • Field Summary

      • Fields inherited from class org.apache.flink.api.common.io.FileOutputFormat

        outputFilePath, stream
    • Constructor Detail

      • AvroOutputFormat

        public AvroOutputFormat​(org.apache.flink.core.fs.Path filePath,
                                Class<E> type)
      • AvroOutputFormat

        public AvroOutputFormat​(Class<E> type)
    • Method Detail

      • getDirectoryFileName

        protected String getDirectoryFileName​(int taskNumber)
        Overrides:
        getDirectoryFileName in class org.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:
        writeRecord in interface org.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:
        open in interface org.apache.flink.api.common.io.OutputFormat<E>
        Overrides:
        open in class org.apache.flink.api.common.io.FileOutputFormat<E>
        Throws:
        IOException
      • close

        public void close()
                   throws IOException
        Specified by:
        close in interface org.apache.flink.api.common.io.OutputFormat<E>
        Overrides:
        close in class org.apache.flink.api.common.io.FileOutputFormat<E>
        Throws:
        IOException