Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gstvg committed Aug 30, 2024
1 parent e35aaa0 commit 6100d7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arrow-array/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub trait Array: std::fmt::Debug + Send + Sync {
///
/// The physical representation is efficient, but is sometimes non intuitive
/// for certain array types such as those with nullable child arrays like
/// [`DictionaryArray::values`] or [`RunArray::values`], or without a
/// [`DictionaryArray::values`], [`RunArray::values`] or [`UnionArray`], or without a
/// null buffer, such as [`NullArray`].
///
/// To determine if each element of such an array is "logically" null,
Expand Down Expand Up @@ -218,7 +218,7 @@ pub trait Array: std::fmt::Debug + Send + Sync {
///
/// Note: For performance reasons, this method returns nullability solely as determined by the
/// null buffer. This difference can lead to surprising results, for example, [`NullArray::is_null`] always
/// returns `false` as the array lacks a null buffer. Similarly [`DictionaryArray`] and [`RunArray`] may
/// returns `false` as the array lacks a null buffer. Similarly [`DictionaryArray`], [`RunArray`] and [`UnionArray`] may
/// encode nullability in their children. See [`Self::logical_nulls`] for more information.
///
/// # Example:
Expand Down Expand Up @@ -284,6 +284,8 @@ pub trait Array: std::fmt::Debug + Send + Sync {
/// are present. For example a [`DictionaryArray`] with nullable values will still return true,
/// even if the nulls present in [`DictionaryArray::values`] are not referenced by any key,
/// and therefore would not appear in [`Array::logical_nulls`].
/// Similary, a [`UnionArray`] with any nullable child will always return true, even if all
/// selected values are valid, and therefore would not appear in [`Array::logical_nulls`].
fn is_nullable(&self) -> bool {
self.null_count() != 0
}
Expand Down
4 changes: 4 additions & 0 deletions arrow-array/src/array/union_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ impl UnionArray {
(is_first & first_nulls) | union_nulls
});

// SAFETY:
// chunks is a ChunksExact iterator, which implements TrustedLen, and correctly reports its length
let mut buffer = unsafe { MutableBuffer::from_trusted_len_iter(chunks) };

if !remainder.is_empty() {
Expand Down Expand Up @@ -493,6 +495,8 @@ impl UnionArray {
!any_nullable_is_selected | union_nulls
});

// SAFETY:
// chunks is a ChunksExact iterator, which implements TrustedLen, and correctly reports its length
let mut buffer = unsafe { MutableBuffer::from_trusted_len_iter(chunks) };

if !remainder.is_empty() {
Expand Down

0 comments on commit 6100d7a

Please sign in to comment.