MCPcopy Create free account
hub / github.com/apache/arrow-rs / append_array

Method append_array

arrow-array/src/builder/generic_bytes_view_builder.rs:223–250  ·  view source on GitHub ↗

Appends an array to the builder. This will flush any in-progress block and append the data buffers and add the (adapted) views.

(&mut self, array: &GenericByteViewArray<T>)

Source from the content-addressed store, hash-verified

221 /// This will flush any in-progress block and append the data buffers
222 /// and add the (adapted) views.
223 pub fn append_array(&mut self, array: &GenericByteViewArray<T>) {
224 self.flush_in_progress();
225 // keep original views if this array is the first to be added or if there are no data buffers (all inline views)
226 let keep_views = self.completed.is_empty() || array.data_buffers().is_empty();
227 let starting_buffer = self.completed.len() as u32;
228
229 self.completed.extend(array.data_buffers().iter().cloned());
230
231 if keep_views {
232 self.views_buffer.extend_from_slice(array.views());
233 } else {
234 self.views_buffer.extend(array.views().iter().map(|v| {
235 let mut byte_view = ByteView::from(*v);
236 if byte_view.length > MAX_INLINE_VIEW_LEN {
237 // Small views (<=12 bytes) are inlined, so only need to update large views
238 byte_view.buffer_index += starting_buffer;
239 };
240
241 byte_view.as_u128()
242 }));
243 }
244
245 if let Some(null_buffer) = array.nulls() {
246 self.null_buffer_builder.append_buffer(null_buffer);
247 } else {
248 self.null_buffer_builder.append_n_non_nulls(array.len());
249 }
250 }
251
252 /// Try to append a view of the given `block`, `offset` and `length`
253 ///

Callers

nothing calls this directly

Calls 12

flush_in_progressMethod · 0.80
data_buffersMethod · 0.80
extend_from_sliceMethod · 0.80
viewsMethod · 0.80
as_u128Method · 0.80
append_n_non_nullsMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
extendMethod · 0.45
iterMethod · 0.45
nullsMethod · 0.45
append_bufferMethod · 0.45

Tested by

no test coverage detected