You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/02/28 19:31:20 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3778: Use NullBuffer in ArrayData (#3775)

tustvold commented on code in PR #3778:
URL: https://github.com/apache/arrow-rs/pull/3778#discussion_r1120672808


##########
arrow-arith/src/boolean.rs:
##########
@@ -425,14 +420,14 @@ pub fn is_null(input: &dyn Array) -> Result<BooleanArray, ArrowError> {
 pub fn is_not_null(input: &dyn Array) -> Result<BooleanArray, ArrowError> {
     let len = input.len();
 
-    let output = match input.data_ref().null_buffer() {
+    let output = match input.data_ref().nulls() {
         None => {
             let len_bytes = ceil(len, 8);
             MutableBuffer::new(len_bytes)
                 .with_bitset(len_bytes, true)
                 .into()
         }
-        Some(buffer) => buffer.bit_slice(input.offset(), len),
+        Some(nulls) => nulls.inner().sliced(),

Review Comment:
   Eventually the use of a sliceable NullBuffer will allow us to not need to slice the buffer, and instead just preserve the offset



##########
arrow-arith/src/boolean.rs:
##########
@@ -425,14 +420,14 @@ pub fn is_null(input: &dyn Array) -> Result<BooleanArray, ArrowError> {
 pub fn is_not_null(input: &dyn Array) -> Result<BooleanArray, ArrowError> {
     let len = input.len();
 
-    let output = match input.data_ref().null_buffer() {
+    let output = match input.data_ref().nulls() {
         None => {
             let len_bytes = ceil(len, 8);
             MutableBuffer::new(len_bytes)
                 .with_bitset(len_bytes, true)
                 .into()
         }
-        Some(buffer) => buffer.bit_slice(input.offset(), len),
+        Some(nulls) => nulls.inner().sliced(),

Review Comment:
   Eventually the use of a sliceable NullBuffer will allow us to not need to slice the buffer, and instead just preserve the offset, but I wanted to keep the changes in this PR down



-- 
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