MCPcopy Index your code
hub / github.com/apache/orc / includeColumns

Method includeColumns

java/core/src/java/org/apache/orc/OrcUtils.java:55–79  ·  view source on GitHub ↗

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

(String selectedColumns,
                                         TypeDescription schema)

Source from the content-addressed store, hash-verified

53 * @return - boolean array with true value set for the specified column names
54 */
55 public static boolean[] includeColumns(String selectedColumns,
56 TypeDescription schema) {
57 int numFlattenedCols = schema.getMaximumId();
58 boolean[] results = new boolean[numFlattenedCols + 1];
59 if ("*".equals(selectedColumns)) {
60 Arrays.fill(results, true);
61 return results;
62 }
63 TypeDescription baseSchema = SchemaEvolution.checkAcidSchema(schema) ?
64 SchemaEvolution.getBaseRow(schema) : schema;
65
66 if (selectedColumns != null &&
67 baseSchema.getCategory() == TypeDescription.Category.STRUCT) {
68
69 for (String columnName : selectedColumns.split(COMMA_STR)) {
70 TypeDescription column = findColumn(baseSchema, columnName.trim());
71 if (column != null) {
72 for (int i = column.getId(); i <= column.getMaximumId(); ++i) {
73 results[i] = true;
74 }
75 }
76 }
77 }
78 return results;
79 }
80
81 private static TypeDescription findColumn(TypeDescription schema, String column) {
82 TypeDescription result = schema;

Calls 7

getMaximumIdMethod · 0.95
checkAcidSchemaMethod · 0.95
getBaseRowMethod · 0.95
getCategoryMethod · 0.95
findColumnMethod · 0.95
getIdMethod · 0.95
equalsMethod · 0.45