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

Function ConcatenateBitmaps

cpp/src/arrow/array/concatenate.cc:105–128  ·  view source on GitHub ↗

Allocate a buffer and concatenate bitmaps into it.

Source from the content-addressed store, hash-verified

103
104// Allocate a buffer and concatenate bitmaps into it.
105Status ConcatenateBitmaps(const std::vector<Bitmap>& bitmaps, MemoryPool* pool,
106 std::shared_ptr<Buffer>* out) {
107 int64_t out_length = 0;
108 for (const auto& bitmap : bitmaps) {
109 if (internal::AddWithOverflow(out_length, bitmap.range.length, &out_length)) {
110 return Status::Invalid("Length overflow when concatenating arrays");
111 }
112 }
113 ARROW_ASSIGN_OR_RAISE(*out, AllocateBitmap(out_length, pool));
114 uint8_t* dst = (*out)->mutable_data();
115
116 int64_t bitmap_offset = 0;
117 for (auto bitmap : bitmaps) {
118 if (bitmap.AllSet()) {
119 bit_util::SetBitsTo(dst, bitmap_offset, bitmap.range.length, true);
120 } else {
121 internal::CopyBitmap(bitmap.data, bitmap.range.offset, bitmap.range.length, dst,
122 bitmap_offset);
123 }
124 bitmap_offset += bitmap.range.length;
125 }
126
127 return Status::OK();
128}
129
130int64_t SumBufferSizesInBytes(const BufferVector& buffers) {
131 int64_t size = 0;

Callers 2

ConcatenateMethod · 0.85
VisitMethod · 0.85

Calls 9

AddWithOverflowFunction · 0.85
AllocateBitmapFunction · 0.85
InvalidFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
SetBitsToFunction · 0.50
CopyBitmapFunction · 0.50
OKFunction · 0.50
mutable_dataMethod · 0.45
AllSetMethod · 0.45

Tested by

no test coverage detected