From e266a70f22d2551dd3d156895204e4edd32fb00d Mon Sep 17 00:00:00 2001 From: Navin Keswani Date: Sat, 22 May 2021 18:29:40 +1000 Subject: [PATCH 1/2] Doctests for BooleanArray. --- arrow/src/array/array_boolean.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arrow/src/array/array_boolean.rs b/arrow/src/array/array_boolean.rs index 67af85d167fd..e50a0038b770 100644 --- a/arrow/src/array/array_boolean.rs +++ b/arrow/src/array/array_boolean.rs @@ -27,6 +27,28 @@ use crate::buffer::{Buffer, MutableBuffer}; use crate::util::bit_util; /// Array of bools +/// +/// # Example +/// +/// ``` +/// use arrow::array::{Array, BooleanArray}; +/// let arr = BooleanArray::from(vec![Some(false), Some(true), None, Some(true)]); +/// assert_eq!(4, arr.len()); +/// assert_eq!(0, arr.offset()); +/// assert_eq!(1, arr.null_count()); +/// assert!(arr.is_valid(0)); +/// assert!(!arr.is_null(0)); +/// assert_eq!(false, arr.value(0)); +/// assert!(arr.is_valid(1)); +/// assert!(!arr.is_null(1)); +/// assert_eq!(true, arr.value(1)); +/// assert!(!arr.is_valid(2)); +/// assert!(arr.is_null(2)); +/// assert!(arr.is_valid(3)); +/// assert!(!arr.is_null(3)); +/// assert_eq!(true, arr.value(3)); +/// ``` +/// pub struct BooleanArray { data: ArrayData, /// Pointer to the value array. The lifetime of this must be <= to the value buffer From c1abbe9961fe72d478089e844ecea2e556285da1 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 25 May 2021 07:02:22 +1000 Subject: [PATCH 2/2] Update arrow/src/array/array_boolean.rs Co-authored-by: Andrew Lamb --- arrow/src/array/array_boolean.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/arrow/src/array/array_boolean.rs b/arrow/src/array/array_boolean.rs index e50a0038b770..8b38b5339553 100644 --- a/arrow/src/array/array_boolean.rs +++ b/arrow/src/array/array_boolean.rs @@ -34,7 +34,6 @@ use crate::util::bit_util; /// use arrow::array::{Array, BooleanArray}; /// let arr = BooleanArray::from(vec![Some(false), Some(true), None, Some(true)]); /// assert_eq!(4, arr.len()); -/// assert_eq!(0, arr.offset()); /// assert_eq!(1, arr.null_count()); /// assert!(arr.is_valid(0)); /// assert!(!arr.is_null(0));