Package org.apache.orc
Class OrcUtils
java.lang.Object
org.apache.orc.OrcUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<StripeInformation>
static TypeDescription
convertTypeFromProtobuf
(List<OrcProto.Type> types, int rootColumn) Translate the given rootColumn from the list of types to a TypeDescription.static List<OrcProto.Type>
getOrcTypes
(TypeDescription typeDescr) static String
Get the software version from Maven.static String
getSoftwareVersion
(int writer, String version) Get the user-facing version string for the software that wrote the file.static boolean[]
includeColumns
(String selectedColumns, TypeDescription schema) Returns selected columns as a boolean array with true value set for specified column names.static int
isValidTypeTree
(List<OrcProto.Type> types, int root) Checks whether the list of protobuf types from the file are valid or not.
-
Constructor Details
-
OrcUtils
public OrcUtils()
-
-
Method Details
-
includeColumns
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 namesschema
- - object schema- Returns:
- - boolean array with true value set for the specified column names
-
getOrcTypes
-
isValidTypeTree
Checks whether the list of protobuf types from the file are valid or not.- Parameters:
types
- the list of types from the protobufroot
- 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 typesrootColumn
- 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
Get the user-facing version string for the software that wrote the file.- Parameters:
writer
- the code for the writer from OrcProto.Footerversion
- the orcVersion from OrcProto.Footer- Returns:
- the version string
-
getOrcVersion
Get the software version from Maven.- Returns:
- The version of the software.
-