org.apache.avro.mapreduce

## Class AvroOutputFormatBase<K,V>

- java.lang.Object
- - org.apache.hadoop.mapreduce.OutputFormat<K,V>
  - - org.apache.hadoop.mapreduce.lib.output.FileOutputFormat<K,V>
    - - org.apache.avro.mapreduce.AvroOutputFormatBase<K,V>

- Type Parameters:
    `K` - The type of key to write.
    `V` - The type of value to write.
  Direct Known Subclasses:
    AvroKeyOutputFormat, AvroKeyValueOutputFormat

      public abstract class AvroOutputFormatBase<K,V>
      extends FileOutputFormat<K,V>

  Abstract base class for output formats that write Avro container files.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.lib.output.FileOutputFormat

      `FileOutputFormat.Counter`

  - ### Field Summary

    - ### Fields inherited from class org.apache.hadoop.mapreduce.lib.output.FileOutputFormat

      `BASE_OUTPUT_NAME, COMPRESS, COMPRESS_CODEC, COMPRESS_TYPE, OUTDIR, PART`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AvroOutputFormatBase()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected OutputStream` | `getAvroFileOutputStream(TaskAttemptContext context)` Gets the target output stream where the Avro container file should be written.
    `protected static CodecFactory` | `getCompressionCodec(TaskAttemptContext context)` Gets the configured compression codec from the task context.
    `protected static int` | `getSyncInterval(TaskAttemptContext context)` Gets the configured sync interval from the task context.

    - ### Methods inherited from class org.apache.hadoop.mapreduce.lib.output.FileOutputFormat

      `checkOutputSpecs, getCompressOutput, getDefaultWorkFile, getOutputCommitter, getOutputCompressorClass, getOutputName, getOutputPath, getPathForWorkFile, getRecordWriter, getUniqueFile, getWorkOutputPath, setCompressOutput, setOutputCompressorClass, setOutputName, setOutputPath`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AvroOutputFormatBase

          public AvroOutputFormatBase()

  - ### Method Detail

    - #### getCompressionCodec

          protected static CodecFactory getCompressionCodec(TaskAttemptContext context)

      Gets the configured compression codec from the task context.
      Parameters:
        `context` - The task attempt context.
      Returns:
        The compression codec to use for the output Avro container file.

    - #### getAvroFileOutputStream

          protected OutputStream getAvroFileOutputStream(TaskAttemptContext context)
                                                  throws IOException

      Gets the target output stream where the Avro container file should be written.
      Parameters:
        `context` - The task attempt context.
      Returns:
        The target output stream.
      Throws:
        `IOException`

    - #### getSyncInterval

          protected static int getSyncInterval(TaskAttemptContext context)

      Gets the configured sync interval from the task context.
      Parameters:
        `context` - The task attempt context.
      Returns:
        The sync interval to use for the output Avro container file.

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.