Class OrcUtils

java.lang.Object
org.apache.orc.OrcUtils

public class OrcUtils extends Object
  • Constructor Details

    • OrcUtils

      public OrcUtils()
  • Method Details

    • includeColumns

      public static boolean[] includeColumns(String selectedColumns, TypeDescription schema)
      Returns selected columns as a boolean array with true value set for specified column names. The result will contain number of elements equal to flattened number of columns. For example: selectedColumns - a,b,c allColumns - a,b,c,d If column c is a complex type, say list<string> and other types are primitives then result will be [false, true, true, true, true, true, false] Index 0 is the root element of the struct which is set to false by default, index 1,2 corresponds to columns a and b. Index 3,4 correspond to column c which is list<string> and index 5 correspond to column d. After flattening list<string> gets 2 columns.

      Column names that aren't found are ignored.

      Parameters:
      selectedColumns - - comma separated list of selected column names
      schema - - object schema
      Returns:
      - boolean array with true value set for the specified column names
    • getOrcTypes

      public static List<OrcProto.Type> getOrcTypes(TypeDescription typeDescr)
    • isValidTypeTree

      public static int isValidTypeTree(List<OrcProto.Type> types, int root) throws IOException
      Checks whether the list of protobuf types from the file are valid or not.
      Parameters:
      types - the list of types from the protobuf
      root - the top of the tree to check
      Returns:
      the next available id
      Throws:
      IOException - if the tree is invalid
    • convertTypeFromProtobuf

      public static TypeDescription convertTypeFromProtobuf(List<OrcProto.Type> types, int rootColumn) throws FileFormatException
      Translate the given rootColumn from the list of types to a TypeDescription.
      Parameters:
      types - all of the types
      rootColumn - translate this type
      Returns:
      a new TypeDescription that matches the given rootColumn
      Throws:
      FileFormatException
    • convertProtoStripesToStripes

      public static List<StripeInformation> convertProtoStripesToStripes(List<OrcProto.StripeInformation> stripes)
    • getSoftwareVersion

      public static String getSoftwareVersion(int writer, String version)
      Get the user-facing version string for the software that wrote the file.
      Parameters:
      writer - the code for the writer from OrcProto.Footer
      version - the orcVersion from OrcProto.Footer
      Returns:
      the version string
    • getOrcVersion

      public static String getOrcVersion()
      Get the software version from Maven.
      Returns:
      The version of the software.