MCPcopy Create free account
hub / github.com/bytedance/bolt / flattenMap

Function flattenMap

bolt/functions/lib/LambdaFunctionUtil.cpp:131–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131MapVectorPtr flattenMap(
132 const SelectivityVector& rows,
133 const VectorPtr& vector,
134 DecodedVector& decodedVector) {
135 if (decodedVector.isIdentityMapping()) {
136 return std::dynamic_pointer_cast<MapVector>(vector);
137 }
138
139 auto newNumElements = countElements<MapVector>(rows, decodedVector);
140
141 BufferPtr newNulls;
142 BufferPtr elementIndices;
143 BufferPtr newSizes;
144 BufferPtr newOffsets;
145 flattenBuffers<MapVector>(
146 rows,
147 newNumElements,
148 decodedVector,
149 newNulls,
150 elementIndices,
151 newSizes,
152 newOffsets);
153
154 auto map = decodedVector.base()->as<MapVector>();
155 return std::make_shared<MapVector>(
156 map->pool(),
157 map->type(),
158 newNulls,
159 rows.end(),
160 newOffsets,
161 newSizes,
162 BaseVector::wrapInDictionary(
163 BufferPtr(nullptr), elementIndices, newNumElements, map->mapKeys()),
164 BaseVector::wrapInDictionary(
165 BufferPtr(nullptr),
166 elementIndices,
167 newNumElements,
168 map->mapValues()));
169}
170
171BufferPtr addNullsForUnselectedRows(
172 const VectorPtr& vector,

Callers 6

flattenContainerMethod · 0.85
flattenContainerMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 8

wrapInDictionaryFunction · 0.85
isIdentityMappingMethod · 0.80
baseMethod · 0.45
poolMethod · 0.45
typeMethod · 0.45
endMethod · 0.45
mapKeysMethod · 0.45
mapValuesMethod · 0.45

Tested by

no test coverage detected