Class OrcFile

java.lang.Object
org.apache.orc.OrcFile

public class OrcFile extends Object
Contains factory methods to read or write ORC files.
  • Field Details

  • Constructor Details

    • OrcFile

      protected OrcFile()
  • Method Details

    • readerOptions

      public static OrcFile.ReaderOptions readerOptions(Configuration conf)
    • createReader

      public static Reader createReader(Path path, OrcFile.ReaderOptions options) throws IOException
      Throws:
      IOException
    • writerOptions

      public static OrcFile.WriterOptions writerOptions(Configuration conf)
      Create a set of writer options based on a configuration.
      Parameters:
      conf - the configuration to use for values
      Returns:
      A WriterOptions object that can be modified
    • writerOptions

      public static OrcFile.WriterOptions writerOptions(Properties tableProperties, Configuration conf)
      Create a set of write options based on a set of table properties and configuration.
      Parameters:
      tableProperties - the properties of the table
      conf - the configuration of the query
      Returns:
      a WriterOptions object that can be modified
    • createWriter

      public static Writer createWriter(Path path, OrcFile.WriterOptions opts) throws IOException
      Create an ORC file writer. This is the public interface for creating writers going forward and new options will only be added to this method.
      Parameters:
      path - filename to write to
      opts - the options
      Returns:
      a new ORC file writer
      Throws:
      IOException
    • mergeFiles

      public static List<Path> mergeFiles(Path outputPath, OrcFile.WriterOptions options, List<Path> inputFiles) throws IOException
      Merges multiple ORC files that all have the same schema to produce a single ORC file. The merge will reject files that aren't compatible with the merged file so the output list may be shorter than the input list. The stripes are copied as serialized byte buffers. The user metadata are merged and files that disagree on the value associated with a key will be rejected.
      Parameters:
      outputPath - the output file
      options - the options for writing with although the options related to the input files' encodings are overridden
      inputFiles - the list of files to merge
      Returns:
      the list of files that were successfully merged
      Throws:
      IOException