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

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    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 Summary

    Constructors
    Constructor
    Description
     
    AvroOutputFormat(org.apache.flink.core.fs.Path filePath, Class<E> type)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected String
    getDirectoryFileName(int taskNumber)
     
    void
    open(org.apache.flink.api.common.io.OutputFormat.InitializationContext context)
     
    void
    Set avro codec for compression.
    void
    setSchema(org.apache.avro.Schema schema)
     
    void
    writeRecord(E record)
     

    Methods inherited from class org.apache.flink.api.common.io.FileOutputFormat

    configure, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError

    Methods inherited from class org.apache.flink.api.common.io.RichOutputFormat

    getRuntimeContext, setRuntimeContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AvroOutputFormat

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

      public AvroOutputFormat(Class<E> type)
  • Method Details

    • 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