alamb commented on code in PR #3529:
URL: https://github.com/apache/arrow-rs/pull/3529#discussion_r1070552343
##########
arrow-data/src/data.rs:
##########
@@ -245,18 +245,58 @@ pub(crate) fn into_buffers(
/// An generic representation of Arrow array data which encapsulates common
attributes and
/// operations for Arrow array. Specific operations for different arrays types
(e.g.,
/// primitive, list, struct) are implemented in `Array`.
+///
+/// # Memory Layout
+///
+/// `ArrayData` has references to one or more underlying data buffers
+/// and optional child ArrayDatas, depending on type as illustrated
+/// below. Bitmaps are not shown for similicity but they are stored
+/// similiarly to the buffers.
+///
+/// ```text
+/// offset
+/// points to
+/// ┌───────────────────┐ start of ┌───────┐ Different
+/// │ │ data │ │ ArrayData may
+/// │ArrayData { │ │.... │ also refer to
+/// │ data_type: ... │ ─ ─ ─ ─▶│1234 │ ┌ ─ the same
+/// │ offset: ... ─ ─ ─│─ ┘ │4372 │ underlying
+/// │ len: ... ─ ─ ─│─ ┐ │4888 │ │ buffer
+/// │ buffers: [ │ │5882 │◀─
+/// │ ... │ │ │4323 │
+/// │ ] │ ─ ─ ─ ─▶│4859 │
+/// │ child_data: [ │ │.... │
+/// │ ... │ │ │
+/// │ ] │ └───────┘
+/// │} │
+/// │ │ Shared Buffer uses
+/// │ │ │ bytes::Bytes to hold
+/// └───────────────────┘ actual data values
+/// ┌ ─ ─ ┘
+///
+/// ▼
+/// ┌───────────────────┐
+/// │ArrayData { │
+/// │ ... │
+/// │} │
+/// │ │
+/// └───────────────────┘
+///
+/// Child ArrayData may also have its own buffers and children
+/// ```
+
#[derive(Debug, Clone)]
pub struct ArrayData {
/// The data type for this array data
data_type: DataType,
- /// The number of elements in this array data
+ /// The number of elements in this array data.
Review Comment:
sorry I had at some point added some more text to this ad then thought
better of it. Will remove the change
```suggestion
/// The number of elements in this array data
```
##########
arrow-data/src/data.rs:
##########
@@ -245,18 +245,58 @@ pub(crate) fn into_buffers(
/// An generic representation of Arrow array data which encapsulates common
attributes and
/// operations for Arrow array. Specific operations for different arrays types
(e.g.,
/// primitive, list, struct) are implemented in `Array`.
+///
+/// # Memory Layout
+///
+/// `ArrayData` has references to one or more underlying data buffers
+/// and optional child ArrayDatas, depending on type as illustrated
+/// below. Bitmaps are not shown for similicity but they are stored
+/// similiarly to the buffers.
+///
+/// ```text
+/// offset
+/// points to
+/// ┌───────────────────┐ start of ┌───────┐ Different
+/// │ │ data │ │ ArrayData may
+/// │ArrayData { │ │.... │ also refer to
+/// │ data_type: ... │ ─ ─ ─ ─▶│1234 │ ┌ ─ the same
+/// │ offset: ... ─ ─ ─│─ ┘ │4372 │ underlying
+/// │ len: ... ─ ─ ─│─ ┐ │4888 │ │ buffer
+/// │ buffers: [ │ │5882 │◀─
+/// │ ... │ │ │4323 │
+/// │ ] │ ─ ─ ─ ─▶│4859 │
+/// │ child_data: [ │ │.... │
+/// │ ... │ │ │
+/// │ ] │ └───────┘
+/// │} │
+/// │ │ Shared Buffer uses
+/// │ │ │ bytes::Bytes to hold
+/// └───────────────────┘ actual data values
+/// ┌ ─ ─ ┘
+///
+/// ▼
+/// ┌───────────────────┐
+/// │ArrayData { │
+/// │ ... │
+/// │} │
+/// │ │
+/// └───────────────────┘
+///
+/// Child ArrayData may also have its own buffers and children
+/// ```
+
#[derive(Debug, Clone)]
pub struct ArrayData {
/// The data type for this array data
data_type: DataType,
- /// The number of elements in this array data
+ /// The number of elements in this array data.
len: usize,
/// The number of null elements in this array data
null_count: usize,
- /// The offset into this array data, in number of items
+ /// The offset into this array data, in number of items.
Review Comment:
```suggestion
/// The offset into this array data, in number of items
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]