MCPcopy Create free account
hub / github.com/apache/arrow / OptionalBitmapAnd

Function OptionalBitmapAnd

cpp/src/arrow/util/bitmap_ops.cc:332–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332Result<std::shared_ptr<Buffer>> OptionalBitmapAnd(MemoryPool* pool,
333 const std::shared_ptr<Buffer>& left,
334 int64_t left_offset,
335 const std::shared_ptr<Buffer>& right,
336 int64_t right_offset, int64_t length,
337 int64_t out_offset) {
338 if (left == nullptr && right == nullptr) {
339 return nullptr;
340 }
341 if (left == nullptr) {
342 if (right_offset >= out_offset && (right_offset - out_offset) % 8 == 0) {
343 int64_t byte_shift = (right_offset - out_offset) / 8;
344 int64_t byte_length = bit_util::BytesForBits(out_offset + length);
345 return SliceBuffer(right, byte_shift, byte_length);
346 }
347 return CopyBitmap(pool, right->data(), right_offset, length, out_offset);
348 }
349 if (right == nullptr) {
350 if (left_offset >= out_offset && (left_offset - out_offset) % 8 == 0) {
351 int64_t byte_shift = (left_offset - out_offset) / 8;
352 int64_t byte_length = bit_util::BytesForBits(out_offset + length);
353 return SliceBuffer(left, byte_shift, byte_length);
354 }
355 return CopyBitmap(pool, left->data(), left_offset, length, out_offset);
356 }
357
358 return BitmapAnd(pool, left->data(), left_offset, right->data(), right_offset, length,
359 out_offset);
360}
361
362namespace {
363

Callers 1

FinalizeMethod · 0.85

Calls 5

BytesForBitsFunction · 0.85
SliceBufferFunction · 0.85
BitmapAndFunction · 0.85
CopyBitmapFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected