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

org.apache.orc

## Interface Reader

- All Superinterfaces:
    AutoCloseable, Closeable
  All Known Implementing Classes:
    ReaderImpl

      public interface Reader
      extends Closeable

  The interface for reading ORC files. One Reader can support multiple concurrent RecordReader.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Reader.Options` Options for creating a RecordReader.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `EncryptionKey[]` | `getColumnEncryptionKeys()` Get the list of encryption keys for column encryption.
    `CompressionKind` | `getCompressionKind()` Get the compression kind.
    `int` | `getCompressionSize()` Get the buffer size for the compression.
    `long` | `getContentLength()` Get the length of the file.
    `boolean` | `getConvertToProlepticGregorian()` Should the returned values use the proleptic Gregorian calendar?
    `DataMaskDescription[]` | `getDataMasks()` Get the data masks for the unencrypted variant of the data.
    `EncryptionVariant[]` | `getEncryptionVariants()` Get the list of encryption variants for the data.
    `OrcProto.FileTail` | `getFileTail()` Get the file tail (footer + postscript)
    `OrcFile.Version` | `getFileVersion()` Get the file format version.
    `List<String>` | `getMetadataKeys()` Get the user metadata keys.
    `int` | `getMetadataSize()`
    `ByteBuffer` | `getMetadataValue(String key)` Get a user metadata value.
    `long` | `getNumberOfRows()` Get the number of rows in the file.
    `List<OrcProto.ColumnStatistics>` | `getOrcProtoFileStatistics()` Deprecated. Use `getStatistics()` instead.
    `List<OrcProto.StripeStatistics>` | `getOrcProtoStripeStatistics()` Deprecated. Use `getStripeStatistics()` instead.
    `long` | `getRawDataSize()` Get the deserialized data size of the file
    `long` | `getRawDataSizeFromColIndices(List<Integer> colIds)` Get the deserialized data size of the specified columns ids
    `long` | `getRawDataSizeOfColumns(List<String> colNames)` Get the deserialized data size of the specified columns
    `int` | `getRowIndexStride()` Get the number of rows per a entry in the row index.
    `TypeDescription` | `getSchema()` Get the type of rows in this ORC file.
    `ByteBuffer` | `getSerializedFileFooter()`
    `ColumnStatistics[]` | `getStatistics()` Get the statistics about the columns in the file.
    `List<StripeInformation>` | `getStripes()` Get the list of stripes.
    `List<StripeStatistics>` | `getStripeStatistics()` Get the stripe statistics for all of the columns.
    `List<StripeStatistics>` | `getStripeStatistics(boolean[] include)` Get the stripe statistics from the file.
    `List<OrcProto.Type>` | `getTypes()` Deprecated. use getSchema instead
    `List<StripeStatistics>` | `getVariantStripeStatistics(EncryptionVariant variant)` Get the stripe statistics for a given variant.
    `List<Integer>` | `getVersionList()`
    `OrcFile.WriterVersion` | `getWriterVersion()` Get the version of the writer of this file.
    `boolean` | `hasMetadataValue(String key)` Did the user set the given metadata value.
    `Reader.Options` | `options()` Create a default options object that can be customized for creating a RecordReader.
    `RecordReader` | `rows()` Create a RecordReader that reads everything with the default options.
    `RecordReader` | `rows(Reader.Options options)` Create a RecordReader that uses the options given.
    `boolean` | `writerUsedProlepticGregorian()` Was the file written using the proleptic Gregorian calendar.

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Method Detail

    - #### getNumberOfRows

          long getNumberOfRows()

      Get the number of rows in the file.
      Returns:
        the number of rows

    - #### getRawDataSize

          long getRawDataSize()

      Get the deserialized data size of the file
      Returns:
        raw data size

    - #### getRawDataSizeOfColumns

          long getRawDataSizeOfColumns(List<String> colNames)

      Get the deserialized data size of the specified columns
      Parameters:
        `colNames` - the list of column names
      Returns:
        raw data size of columns

    - #### getRawDataSizeFromColIndices

          long getRawDataSizeFromColIndices(List<Integer> colIds)

      Get the deserialized data size of the specified columns ids
      Parameters:
        `colIds` - - internal column id (check orcfiledump for column ids)
      Returns:
        raw data size of columns

    - #### getMetadataKeys

          List<String> getMetadataKeys()

      Get the user metadata keys.
      Returns:
        the set of metadata keys

    - #### getMetadataValue

          ByteBuffer getMetadataValue(String key)

      Get a user metadata value.
      Parameters:
        `key` - a key given by the user
      Returns:
        the bytes associated with the given key

    - #### hasMetadataValue

          boolean hasMetadataValue(String key)

      Did the user set the given metadata value.
      Parameters:
        `key` - the key to check
      Returns:
        true if the metadata value was set

    - #### getCompressionKind

          CompressionKind getCompressionKind()

      Get the compression kind.
      Returns:
        the kind of compression in the file

    - #### getCompressionSize

          int getCompressionSize()

      Get the buffer size for the compression.
      Returns:
        number of bytes to buffer for the compression codec.

    - #### getRowIndexStride

          int getRowIndexStride()

      Get the number of rows per a entry in the row index.
      Returns:
        the number of rows per an entry in the row index or 0 if there is no row index.

    - #### getStripes

          List<StripeInformation> getStripes()

      Get the list of stripes.
      Returns:
        the information about the stripes in order

    - #### getContentLength

          long getContentLength()

      Get the length of the file.
      Returns:
        the number of bytes in the file

    - #### getStatistics

          ColumnStatistics[] getStatistics()

      Get the statistics about the columns in the file.
      Returns:
        the information about the column

    - #### getSchema

          TypeDescription getSchema()

      Get the type of rows in this ORC file.

    - #### getTypes

          List<OrcProto.Type> getTypes()

      Deprecated. use getSchema instead
      Get the list of types contained in the file. The root type is the first type in the list.
      Returns:
        the list of flattened types

    - #### getFileVersion

          OrcFile.Version getFileVersion()

      Get the file format version.

    - #### getWriterVersion

          OrcFile.WriterVersion getWriterVersion()

      Get the version of the writer of this file.

    - #### getFileTail

          OrcProto.FileTail getFileTail()

      Get the file tail (footer + postscript)
      Returns:
        - file tail

    - #### getColumnEncryptionKeys

          EncryptionKey[] getColumnEncryptionKeys()

      Get the list of encryption keys for column encryption.
      Returns:
        the set of encryption keys

    - #### getDataMasks

          DataMaskDescription[] getDataMasks()

      Get the data masks for the unencrypted variant of the data.
      Returns:
        the lists of data masks

    - #### getEncryptionVariants

          EncryptionVariant[] getEncryptionVariants()

      Get the list of encryption variants for the data.

    - #### getVariantStripeStatistics

          List<StripeStatistics> getVariantStripeStatistics(EncryptionVariant variant)
                                                     throws IOException

      Get the stripe statistics for a given variant. The StripeStatistics will have 1 entry for each column in the variant. This enables the user to get the stripe statistics for each variant regardless of which keys are available.
      Parameters:
        `variant` - the encryption variant or null for unencrypted
      Returns:
        a list of stripe statistics (one per a stripe)
      Throws:
        `IOException` - if the required key is not available

    - #### options

          Reader.Options options()

      Create a default options object that can be customized for creating a RecordReader.
      Returns:
        a new default Options object

    - #### rows

          RecordReader rows()
                     throws IOException

      Create a RecordReader that reads everything with the default options.
      Returns:
        a new RecordReader
      Throws:
        `IOException`

    - #### rows

          RecordReader rows(Reader.Options options)
                     throws IOException

      Create a RecordReader that uses the options given. This method can't be named rows, because many callers used rows(null) before the rows() method was introduced.
      Parameters:
        `options` - the options to read with
      Returns:
        a new RecordReader
      Throws:
        `IOException`

    - #### getVersionList

          List<Integer> getVersionList()

      Returns:
        List of integers representing version of the file, in order from major to minor.

    - #### getMetadataSize

          int getMetadataSize()

      Returns:
        Gets the size of metadata, in bytes.

    - #### getOrcProtoStripeStatistics

          List<OrcProto.StripeStatistics> getOrcProtoStripeStatistics()

      Deprecated. Use `getStripeStatistics()` instead.
      Returns:
        Stripe statistics, in original protobuf form.

    - #### getStripeStatistics

          List<StripeStatistics> getStripeStatistics()
                                              throws IOException

      Get the stripe statistics for all of the columns.
      Returns:
        a list of the statistics for each stripe in the file
      Throws:
        `IOException`

    - #### getStripeStatistics

          List<StripeStatistics> getStripeStatistics(boolean[] include)
                                              throws IOException

      Get the stripe statistics from the file.
      Parameters:
        `include` - null for all columns or an array where the required columns are selected
      Returns:
        a list of the statistics for each stripe in the file
      Throws:
        `IOException`

    - #### getOrcProtoFileStatistics

          List<OrcProto.ColumnStatistics> getOrcProtoFileStatistics()

      Deprecated. Use `getStatistics()` instead.
      Returns:
        File statistics, in original protobuf form.

    - #### getSerializedFileFooter

          ByteBuffer getSerializedFileFooter()

      Returns:
        Serialized file metadata read from disk for the purposes of caching, etc.

    - #### writerUsedProlepticGregorian

          boolean writerUsedProlepticGregorian()

      Was the file written using the proleptic Gregorian calendar.

    - #### getConvertToProlepticGregorian

          boolean getConvertToProlepticGregorian()

      Should the returned values use the proleptic Gregorian calendar?

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