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

Method acquireSharedStringBuffersRecursive

bolt/vector/FlatVector.cpp:250–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248
249template <>
250void FlatVector<StringView>::acquireSharedStringBuffersRecursive(
251 const BaseVector* source) {
252 if (!source) {
253 return;
254 }
255 source = source->wrappedVector();
256
257 switch (source->encoding()) {
258 case VectorEncoding::Simple::FLAT: {
259 if (source->typeKind() != TypeKind::VARCHAR &&
260 source->typeKind() != TypeKind::VARBINARY) {
261 // Nothing to acquire.
262 return;
263 }
264 auto* flat = source->asUnchecked<FlatVector<StringView>>();
265 for (auto& buffer : flat->stringBuffers_) {
266 addStringBuffer(buffer);
267 }
268 return;
269 }
270
271 case VectorEncoding::Simple::ARRAY: {
272 acquireSharedStringBuffersRecursive(
273 source->asUnchecked<ArrayVector>()->elements().get());
274 return;
275 }
276
277 case VectorEncoding::Simple::MAP: {
278 acquireSharedStringBuffersRecursive(
279 source->asUnchecked<MapVector>()->mapKeys().get());
280 acquireSharedStringBuffersRecursive(
281 source->asUnchecked<MapVector>()->mapValues().get());
282 return;
283 }
284
285 case VectorEncoding::Simple::ROW: {
286 for (auto& child : source->asUnchecked<RowVector>()->children()) {
287 acquireSharedStringBuffersRecursive(child.get());
288 }
289 return;
290 }
291
292 case VectorEncoding::Simple::VARIANT: {
293 auto* variant = source->asUnchecked<VariantVector>();
294 for (auto& child : variant->children()) {
295 acquireSharedStringBuffersRecursive(child.get());
296 }
297 return;
298 }
299
300 case VectorEncoding::Simple::CONSTANT: {
301 // wrappedVector can be constant vector only if the underlying type is
302 // primitive.
303 if (source->typeKind() != TypeKind::VARCHAR &&
304 source->typeKind() != TypeKind::VARBINARY) {
305 // Nothing to acquire.
306 return;
307 }

Callers 2

TEST_FFunction · 0.80

Calls 10

getStringBufferMethod · 0.80
wrappedVectorMethod · 0.45
encodingMethod · 0.45
typeKindMethod · 0.45
getMethod · 0.45
mapKeysMethod · 0.45
mapValuesMethod · 0.45
childrenMethod · 0.45
isNullAtMethod · 0.45
toStringMethod · 0.45

Tested by 1

TEST_FFunction · 0.64