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

Commit

Permalink
Update boolean all logic
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Aug 19, 2023
1 parent 410f9d6 commit 6d6bb47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compute/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub fn or_scalar(array: &BooleanArray, scalar: &BooleanScalar) -> BooleanArray {

/// Returns whether any of the values in the array are `true`.
///
/// Null values are treated as `false`.
/// Null values are ignored.
///
/// # Example
///
Expand Down Expand Up @@ -261,7 +261,7 @@ pub fn any(array: &BooleanArray) -> bool {

/// Returns whether all values in the array are `true`.
///
/// Null values are treated as `false`.
/// Null values are ignored.
///
/// # Example
///
Expand All @@ -275,13 +275,13 @@ pub fn any(array: &BooleanArray) -> bool {
///
/// assert_eq!(all(&a), true);
/// assert_eq!(all(&b), false);
/// assert_eq!(all(&c), false);
/// assert_eq!(all(&c), true);
/// ```
pub fn all(array: &BooleanArray) -> bool {
if array.is_empty() {
true
} else if array.null_count() > 0 {
false
!array.into_iter().any(|v| v == Some(false))
} else {
let vals = array.values();
vals.unset_bits() == 0
Expand Down

0 comments on commit 6d6bb47

Please sign in to comment.