PhysicalWriter (ORC Core 1.6.6 API)
Date: 2021-01-13

org.apache.orc

## Interface PhysicalWriter

- All Known Implementing Classes:
    PhysicalFsWriter

      public interface PhysicalWriter

  This interface separates the physical layout of ORC files from the higher level details. This API is limited to being used by LLAP.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `PhysicalWriter.OutputReceiver` The target of an output stream.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendRawStripe(ByteBuffer stripe, OrcProto.StripeInformation.Builder dirEntry)` Appends raw stripe data (e.g.
    `void` | `close()` Closes the writer.
    `PhysicalWriter.OutputReceiver` | `createDataStream(StreamName name)` Create an OutputReceiver for the given name.
    `void` | `finalizeStripe(OrcProto.StripeFooter.Builder footer, OrcProto.StripeInformation.Builder dirEntry)` Flushes the data in all the streams, spills them to disk, write out stripe footer.
    `void` | `flush()` Flushes the writer so that readers can see the preceeding postscripts.
    `long` | `getFileBytes(int column, WriterEncryptionVariant variant)` Get the number of bytes for a file in a givem column.
    `StreamOptions` | `getStreamOptions()` Get the unencrypted stream options for this file.
    `void` | `writeBloomFilter(StreamName name, OrcProto.BloomFilterIndex.Builder bloom)` Write a bloom filter index in the given stream name.
    `void` | `writeFileFooter(OrcProto.Footer.Builder builder)` Writes out the file footer.
    `void` | `writeFileMetadata(OrcProto.Metadata.Builder builder)` Writes out the file metadata.
    `void` | `writeHeader()` Writes the header of the file, which consists of the magic "ORC" bytes.
    `void` | `writeIndex(StreamName name, OrcProto.RowIndex.Builder index)` Write an index in the given stream name.
    `long` | `writePostScript(OrcProto.PostScript.Builder builder)` Writes out the postscript (including the size byte if needed).
    `void` | `writeStatistics(StreamName name, OrcProto.ColumnStatistics.Builder statistics)` Write a stripe or file statistics to the file.

- - ### Method Detail

    - #### writeHeader

          void writeHeader()
                    throws IOException

      Writes the header of the file, which consists of the magic "ORC" bytes.
      Throws:
        `IOException`

    - #### createDataStream

          PhysicalWriter.OutputReceiver createDataStream(StreamName name)
                                                  throws IOException

      Create an OutputReceiver for the given name.
      Parameters:
        `name` - the name of the stream
      Throws:
        `IOException`

    - #### writeIndex

          void writeIndex(StreamName name,
                          OrcProto.RowIndex.Builder index)
                   throws IOException

      Write an index in the given stream name.
      Parameters:
        `name` - the name of the stream
        `index` - the bloom filter to write
      Throws:
        `IOException`

    - #### writeBloomFilter

          void writeBloomFilter(StreamName name,
                                OrcProto.BloomFilterIndex.Builder bloom)
                         throws IOException

      Write a bloom filter index in the given stream name.
      Parameters:
        `name` - the name of the stream
        `bloom` - the bloom filter to write
      Throws:
        `IOException`

    - #### finalizeStripe

          void finalizeStripe(OrcProto.StripeFooter.Builder footer,
                              OrcProto.StripeInformation.Builder dirEntry)
                       throws IOException

      Flushes the data in all the streams, spills them to disk, write out stripe footer.
      Parameters:
        `footer` - Stripe footer to be updated with relevant data and written out.
        `dirEntry` - File metadata entry for the stripe, to be updated with relevant data.
      Throws:
        `IOException`

    - #### writeStatistics

          void writeStatistics(StreamName name,
                               OrcProto.ColumnStatistics.Builder statistics)
                        throws IOException

      Write a stripe or file statistics to the file.
      Parameters:
        `name` - the name of the stream
        `statistics` - the statistics to write
      Throws:
        `IOException`

    - #### writeFileMetadata

          void writeFileMetadata(OrcProto.Metadata.Builder builder)
                          throws IOException

      Writes out the file metadata.
      Parameters:
        `builder` - Metadata builder to finalize and write.
      Throws:
        `IOException`

    - #### writeFileFooter

          void writeFileFooter(OrcProto.Footer.Builder builder)
                        throws IOException

      Writes out the file footer.
      Parameters:
        `builder` - Footer builder to finalize and write.
      Throws:
        `IOException`

    - #### writePostScript

          long writePostScript(OrcProto.PostScript.Builder builder)
                        throws IOException

      Writes out the postscript (including the size byte if needed).
      Parameters:
        `builder` - Postscript builder to finalize and write.
      Throws:
        `IOException`

    - #### close

          void close()
              throws IOException

      Closes the writer.
      Throws:
        `IOException`

    - #### flush

          void flush()
              throws IOException

      Flushes the writer so that readers can see the preceeding postscripts.
      Throws:
        `IOException`

    - #### appendRawStripe

          void appendRawStripe(ByteBuffer stripe,
                               OrcProto.StripeInformation.Builder dirEntry)
                        throws IOException

      Appends raw stripe data (e.g. for file merger).
      Parameters:
        `stripe` - Stripe data buffer.
        `dirEntry` - File metadata entry for the stripe, to be updated with relevant data.
      Throws:
        `IOException`

    - #### getFileBytes

          long getFileBytes(int column,
                            WriterEncryptionVariant variant)

      Get the number of bytes for a file in a givem column.
      Parameters:
        `column` - column from which to get file size
        `variant` - the encryption variant to check
      Returns:
        number of bytes for the given column

    - #### getStreamOptions

          StreamOptions getStreamOptions()

      Get the unencrypted stream options for this file. This class needs the stream options to write the indexes and footers. Additionally, the LLAP CacheWriter wants to disable the generic compression.

Copyright © 2013–2021 The Apache Software Foundation. All rights reserved.