Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Adding new constructor for MutableListArray (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjermain committed Jun 19, 2023
1 parent 2d2e705 commit 0d568a3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/array/list/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,23 @@ impl<O: Offset, M: MutableArray> MutableListArray<O, M> {
Self::new_from(values, data_type, capacity)
}

/// Creates a new [`MutableListArray`] from a [`MutableArray`], [`Offsets`] and
/// [`MutableBitmap`].
pub fn new_from_mutable(
values: M,
offsets: Offsets<O>,
validity: Option<MutableBitmap>,
) -> Self {
assert_eq!(values.len(), offsets.last().to_usize());
let data_type = values.data_type().clone();
Self {
data_type,
offsets,
values,
validity,
}
}

#[inline]
/// Needs to be called when a valid value was extended to this array.
/// This is a relatively low level function, prefer `try_push` when you can.
Expand Down

0 comments on commit 0d568a3

Please sign in to comment.