You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jhorstmann (via GitHub)" <gi...@apache.org> on 2023/03/22 12:40:11 UTC

[GitHub] [arrow-rs] jhorstmann commented on a diff in pull request #3898: Add BooleanArray::new (#3879)

jhorstmann commented on code in PR #3898:
URL: https://github.com/apache/arrow-rs/pull/3898#discussion_r1144745229


##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -81,6 +81,28 @@ impl std::fmt::Debug for BooleanArray {
 }
 
 impl BooleanArray {
+    /// Create a new [`BooleanArray`] from the provided values and nulls
+    ///
+    /// # Panics
+    ///
+    /// Panics if `values.len() != nulls.len()`
+    pub fn new(values: BooleanBuffer, nulls: Option<NullBuffer>) -> Self {
+        if let Some(n) = nulls.as_ref() {
+            assert_eq!(values.len(), n.len());
+        }
+
+        // TODO: Don't store ArrayData inside arrays (#3880)
+        let data = unsafe {
+            ArrayData::builder(DataType::Boolean)
+                .len(values.len())
+                .offset(values.offset())

Review Comment:
   Not directly related to the `BooleanArray`, but do we now allow different offsets for values and null buffers and do compute kernels handle this correctly?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org