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

Function tryReuseResult

bolt/dwio/common/SelectiveStructColumnReader.cpp:292–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290 }
291}
292
293VectorPtr tryReuseResult(const VectorPtr& result) {
294 if (result.use_count() != 1) {
295 return nullptr;
296 }
297 switch (result->encoding()) {
298 case VectorEncoding::Simple::ROW:
299 // Do not call prepareForReuse as it would throw away constant vectors
300 // that can be reused. Reusability of children should be checked in
301 // getValues of child readers (all readers other than struct are
302 // recreating the result vector on each batch currently, so no issue with
303 // reusability now).
304 result->reuseNulls();
305 result->clearContainingLazyAndWrapped();
306 return result;
307 case VectorEncoding::Simple::LAZY: {
308 auto& lazy = static_cast<const LazyVector&>(*result);
309 if (!lazy.isLoaded()) {
310 return nullptr;
311 }
312 return tryReuseResult(lazy.loadedVectorShared());
313 }
314 case VectorEncoding::Simple::DICTIONARY:
315 return tryReuseResult(result->valueVector());
316 default:
317 return nullptr;
318 }
319}
320
321void setConstantField(

Callers 1

getValuesMethod · 0.85

Calls 3

reuseNullsMethod · 0.80
isLoadedMethod · 0.80
encodingMethod · 0.45

Tested by

no test coverage detected