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

Method PropagateSingle

cpp/src/arrow/compute/exec.cc:579–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577 }
578
579 Status PropagateSingle() {
580 // One array
581 const ArraySpan& arr = *arrays_with_nulls_[0];
582 const uint8_t* arr_bitmap = arr.buffers[0].data;
583
584 // Reuse the null count if it's known
585 output_->null_count = arr.null_count;
586
587 if (bitmap_preallocated_) {
588 CopyBitmap(arr_bitmap, arr.offset, arr.length, bitmap_, output_->offset);
589 return Status::OK();
590 }
591
592 // Two cases when memory was not pre-allocated:
593 //
594 // * Offset is zero: we reuse the bitmap as is
595 // * Offset is nonzero but a multiple of 8: we can slice the bitmap
596 // * Offset is not a multiple of 8: we must allocate and use CopyBitmap
597 //
598 // Keep in mind that output_->offset is not permitted to be nonzero when
599 // the bitmap is not preallocated, and that precondition is asserted
600 // higher in the call stack.
601 if (arr.offset == 0) {
602 output_->buffers[0] = arr.GetBuffer(0);
603 } else if (arr.offset % 8 == 0) {
604 output_->buffers[0] = SliceBuffer(arr.GetBuffer(0), arr.offset / 8,
605 bit_util::BytesForBits(arr.length));
606 } else {
607 RETURN_NOT_OK(EnsureAllocated());
608 CopyBitmap(arr_bitmap, arr.offset, arr.length, bitmap_, /*dst_offset=*/0);
609 }
610 return Status::OK();
611 }
612
613 Status PropagateMultiple() {
614 // More than one array. We use BitmapAnd to intersect their bitmaps

Callers

nothing calls this directly

Calls 5

SliceBufferFunction · 0.85
BytesForBitsFunction · 0.85
CopyBitmapFunction · 0.50
OKFunction · 0.50
GetBufferMethod · 0.45

Tested by

no test coverage detected