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

Method findColumn

java/core/src/java/org/apache/orc/OrcUtils.java:81–108  ·  view source on GitHub ↗
(TypeDescription schema, String column)

Source from the content-addressed store, hash-verified

79 }
80
81 private static TypeDescription findColumn(TypeDescription schema, String column) {
82 TypeDescription result = schema;
83 String[] columnMatcher = column.split("\\.");
84
85 int index = 0;
86 while (index < columnMatcher.length &&
87 result.getCategory() == TypeDescription.Category.STRUCT) {
88
89 String columnName = columnMatcher[index];
90 int prevIndex = index;
91
92 List<TypeDescription> fields = result.getChildren();
93 List<String> fieldNames = result.getFieldNames();
94
95 for (int i = 0; i < fields.size(); i++) {
96 if (columnName.equalsIgnoreCase(fieldNames.get(i))) {
97 result = fields.get(i);
98 index++;
99
100 break;
101 }
102 }
103 if (prevIndex == index) {
104 return null;
105 }
106 }
107 return result;
108 }
109
110 public static List<OrcProto.Type> getOrcTypes(TypeDescription typeDescr) {
111 List<OrcProto.Type> result = new ArrayList<>();

Callers 1

includeColumnsMethod · 0.95

Calls 5

getCategoryMethod · 0.95
getChildrenMethod · 0.95
getFieldNamesMethod · 0.95
sizeMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected