Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,26 +201,45 @@ pub(crate) fn new_buffers(data_type: &DataType, capacity: usize) -> [MutableBuff

#[derive(Debug, Clone)]
pub struct ArrayData {
/// The data type for this array data
/// The data type
data_type: DataType,

/// The number of elements in this array data
/// The number of elements
len: usize,

/// The offset into this array data, in number of items
/// The offset in number of items (not bytes).
///
/// The offset applies to [`Self::child_data`] and [`Self::buffers`]. It
/// does NOT apply to [`Self::nulls`].
offset: usize,

/// The buffers for this array data. Note that depending on the array types, this
/// could hold different kinds of buffers (e.g., value buffer, value offset buffer)
/// at different positions.
/// The buffers that store the actual data for this array, as defined
/// in the [Arrow Spec].
///
/// Depending on the array types, [`Self::buffers`] can hold different
/// kinds of buffers (e.g., value buffer, value offset buffer) at different
/// positions.
///
/// This ArrayData's first logical element begins at `offset`
Comment thread
alamb marked this conversation as resolved.
Outdated
///
/// [Arrow Spec](https://arrow.apache.org/docs/format/Columnar.html#physical-memory-layout)
buffers: Vec<Buffer>,

/// The child(ren) of this array. Only non-empty for nested types, currently
/// `ListArray` and `StructArray`.
/// The child(ren) of this array.
///
/// Only non-empty for nested types, such as `ListArray` and
/// `StructArray`.
///
/// The first logical element in each child element begins at `offset`.
Comment thread
alamb marked this conversation as resolved.
child_data: Vec<ArrayData>,

/// The null bitmap. A `None` value for this indicates all values are non-null in
/// this array.
/// The null bitmap.
///
/// `None` indicates all values are non-null in this array.
///
/// [`Self::offset]` does not apply to the null bitmap. While the
/// BooleanBuffer may be sliced (have its own offset) internally, this
/// `NullBuffer` always represents exactly `len` elements.
nulls: Option<NullBuffer>,
}

Expand Down Expand Up @@ -555,6 +574,7 @@ impl ArrayData {
}

/// Returns the `buffer` as a slice of type `T` starting at self.offset
///
/// # Panics
/// This function panics if:
/// * the buffer is not byte-aligned with type T, or
Expand Down
Loading