MCPcopy Create free account
hub / github.com/apache/orc / selectParents

Method selectParents

c++/src/Reader.cc:125–147  ·  view source on GitHub ↗

* Recurses over a type tree and selects the parents of every selected type. * @return true if any child was selected. */

Source from the content-addressed store, hash-verified

123 * @return true if any child was selected.
124 */
125 bool ColumnSelector::selectParents(std::vector<bool>& selectedColumns, const Type& type) {
126 size_t id = static_cast<size_t>(type.getColumnId());
127 bool result = selectedColumns[id];
128 uint64_t numSubtypeSelected = 0;
129 for (uint64_t c = 0; c < type.getSubtypeCount(); ++c) {
130 if (selectParents(selectedColumns, *type.getSubtype(c))) {
131 result = true;
132 numSubtypeSelected++;
133 }
134 }
135 selectedColumns[id] = result;
136
137 if (type.getKind() == TypeKind::UNION && selectedColumns[id]) {
138 if (0 < numSubtypeSelected && numSubtypeSelected < type.getSubtypeCount()) {
139 // Subtypes of UNION should be fully selected or not selected at all.
140 // Override partial subtype selections with full selections.
141 for (uint64_t c = 0; c < type.getSubtypeCount(); ++c) {
142 selectChildren(selectedColumns, *type.getSubtype(c));
143 }
144 }
145 }
146 return result;
147 }
148
149 /**
150 * Recurses over a type tree and build two maps

Callers 3

getMemoryUseByFieldIdMethod · 0.80
getMemoryUseByNameMethod · 0.80
getMemoryUseByTypeIdMethod · 0.80

Calls 4

getSubtypeCountMethod · 0.80
getSubtypeMethod · 0.80
getColumnIdMethod · 0.65
getKindMethod · 0.65

Tested by

no test coverage detected