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

Method VisitBaseListView

cpp/src/arrow/util/byte_size.cc:248–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247 template <typename BaseListViewType>
248 Status VisitBaseListView(const BaseListViewType& type) const {
249 using offset_type = typename BaseListViewType::offset_type;
250 RETURN_NOT_OK(VisitBitmap(input.buffers[0]));
251
252 const Buffer& offsets_buffer = *input.buffers[1];
253 RETURN_NOT_OK(
254 range_starts->Append(reinterpret_cast<uint64_t>(offsets_buffer.data())));
255 RETURN_NOT_OK(range_offsets->Append(sizeof(offset_type) * offset));
256 RETURN_NOT_OK(range_lengths->Append(sizeof(offset_type) * length));
257
258 const Buffer& lengths_buffer = *input.buffers[2];
259 RETURN_NOT_OK(
260 range_starts->Append(reinterpret_cast<uint64_t>(lengths_buffer.data())));
261 RETURN_NOT_OK(range_offsets->Append(sizeof(offset_type) * offset));
262 RETURN_NOT_OK(range_lengths->Append(sizeof(offset_type) * length));
263
264 // The following calculation is an over estimate of the byte size since views
265 // buffer might
266 // 1. Not reference all the values in data buffers (the array was filtered without gc)
267 // 2. Reference a value multiple times without repeating it in the data buffer
268 //
269 // Producing exact byte size would require linear scan of all values in view buffer
270 GetByteRangesArray child{
271 *input.child_data[0], 0, input.child_data[0]->length, range_starts, range_offsets,
272 range_lengths};
273 return VisitTypeInline(*type.value_type(), &child);
274 }
275
276 Status Visit(const ListViewType& type) const { return VisitBaseListView(type); }
277

Callers

nothing calls this directly

Calls 4

VisitTypeInlineFunction · 0.85
AppendMethod · 0.45
dataMethod · 0.45
value_typeMethod · 0.45

Tested by

no test coverage detected