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

Function copyNulls

bolt/dwio/common/FlatMapHelper.cpp:365–399  ·  view source on GitHub ↗

copy nulls from source to target, return number of nulls copied

Source from the content-addressed store, hash-verified

363
364// copy nulls from source to target, return number of nulls copied
365vector_size_t copyNulls(
366 BaseVector& target,
367 vector_size_t targetIndex,
368 const BaseVector& source,
369 vector_size_t sourceIndex,
370 vector_size_t count) {
371 vector_size_t nulls = 0;
372 // it's assumed that initVector is called before calling this method to
373 // properly allocate/clear nulls buffer. So we only need to check against
374 // target vector here.
375 target.resize(targetIndex + count, false);
376 if (target.mayHaveNulls()) {
377 auto tgtNulls = const_cast<uint64_t*>(target.rawNulls());
378 if (source.isConstantEncoding()) {
379 for (vector_size_t i = 0; i < count; ++i) {
380 bits::setNull(tgtNulls, targetIndex + i);
381 }
382 nulls += count;
383 } else if (auto srcNulls = source.rawNulls()) {
384 for (vector_size_t i = 0; i < count; ++i) {
385 if (bits::isBitNull(srcNulls, sourceIndex + i)) {
386 ++nulls;
387 bits::setNull(tgtNulls, targetIndex + i);
388 } else {
389 bits::clearNull(tgtNulls, targetIndex + i);
390 }
391 }
392 } else {
393 for (vector_size_t i = 0; i < count; ++i) {
394 bits::clearNull(tgtNulls, targetIndex + i);
395 }
396 }
397 }
398 return nulls;
399}
400
401template <TypeKind K>
402void copyImpl(

Callers 10

copyRangesMethod · 0.85
setFlatNullsMethod · 0.85
copyImplFunction · 0.85
BOOLEAN>Method · 0.85
copyStringsFunction · 0.85
copyOffsetsFunction · 0.85
ARRAY>Method · 0.85
ROW>Method · 0.85

Calls 6

isBitNullFunction · 0.85
clearNullFunction · 0.85
rawNullsMethod · 0.80
setNullFunction · 0.50
resizeMethod · 0.45
mayHaveNullsMethod · 0.45

Tested by

no test coverage detected