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

Method DoAppendArraySlice

cpp/src/arrow/array/builder_run_end.cc:225–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223
224template <typename RunEndCType>
225Status RunEndEncodedBuilder::DoAppendArraySlice(const ArraySpan& array, int64_t offset,
226 int64_t length) {
227 ARROW_DCHECK(offset + length <= array.length);
228 DCHECK_GT(length, 0);
229 DCHECK(!value_run_builder_->has_open_run());
230
231 ree_util::RunEndEncodedArraySpan<RunEndCType> ree_span(array, array.offset + offset,
232 length);
233 const int64_t physical_offset = ree_span.PhysicalIndex(0);
234 const int64_t physical_length =
235 ree_span.PhysicalIndex(ree_span.length() - 1) + 1 - physical_offset;
236
237 RETURN_NOT_OK(ReservePhysical(physical_length));
238
239 // Append all the run ends from array sliced by offset and length
240 for (auto it = ree_span.iterator(0, physical_offset); !it.is_end(ree_span); ++it) {
241 const int64_t run_end = committed_logical_length_ + it.run_length();
242 RETURN_NOT_OK(DoAppendRunEnd<RunEndCType>(run_end));
243 UpdateDimensions(run_end, 0);
244 }
245
246 // Append all the values directly
247 RETURN_NOT_OK(value_run_builder_->AppendRunCompressedArraySlice(
248 ree_util::ValuesArray(array), physical_offset, physical_length));
249
250 return Status::OK();
251}
252
253Status RunEndEncodedBuilder::AppendArraySlice(const ArraySpan& array, int64_t offset,
254 int64_t length) {

Callers

nothing calls this directly

Calls 9

ReservePhysicalFunction · 0.85
has_open_runMethod · 0.80
iteratorMethod · 0.80
OKFunction · 0.50
PhysicalIndexMethod · 0.45
lengthMethod · 0.45
is_endMethod · 0.45
run_lengthMethod · 0.45

Tested by

no test coverage detected