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/09/13 10:16:27 UTC

[GitHub] [arrow-rs] jhorstmann opened a new issue, #4810: ArrayData::try_new/new_unchecked should take NullBuffer or BooleanBuffer for nulls to preserve offsets

jhorstmann opened a new issue, #4810:
URL: https://github.com/apache/arrow-rs/issues/4810

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for this feature, in addition to  the *what*)
   -->
   
   Since the introduction of `BooleanBuffer` the validity and data buffers of an array could have differing offsets. For example the following test passes:
   
   ```
   let values = BooleanBuffer::from(vec![true, false, true, false]).slice(1, 3);
   let nulls = BooleanBuffer::from(vec![true, false, true, false, true]).slice(2, 3);
   
   let array = BooleanArray::new(values, Some(NullBuffer::new(nulls)));
   
   let data = array.into_data();
   assert_eq!(data.offset(), 1);
   assert_eq!(data.nulls().map(|n| n.offset()), Some(2));
   ```
   
   However there seems to be no constructor of `ArrayData` that allows creating such data directly. Both `try_new` and `new_unchecked` take an untyped `Buffer` for the `null_bit_buffer`.
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   The `null_bit_buffer` parameter should be changed to be of type `Option<NullBuffer>`. This should also simplify some of the validation logic in `try_new` and allow to remove the `null_count` parameter from `new_unchecked`.
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features you've considered.
   -->
   
   The parameter could also be of type `Option<BooleanBuffer>` and keep the `null_count` parameter, but using `NullBuffer` is probably the better encapsulation.
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


-- 
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.apache.org

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


Re: [I] ArrayData::try_new/new_unchecked should take NullBuffer or BooleanBuffer for nulls to preserve offsets [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4810: ArrayData::try_new/new_unchecked should take NullBuffer or BooleanBuffer for nulls to preserve offsets
URL: https://github.com/apache/arrow-rs/issues/4810


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


[GitHub] [arrow-rs] tustvold commented on issue #4810: ArrayData::try_new/new_unchecked should take NullBuffer or BooleanBuffer for nulls to preserve offsets

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #4810:
URL: https://github.com/apache/arrow-rs/issues/4810#issuecomment-1717368476

   `ArrayData::try_new` and `ArrayData::new_unchecked` simply call through to `ArrayDataBuilder` which provides support for setting nulls directly.


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


Re: [I] ArrayData::try_new/new_unchecked should take NullBuffer or BooleanBuffer for nulls to preserve offsets [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #4810:
URL: https://github.com/apache/arrow-rs/issues/4810#issuecomment-2002162191

   Just doing some backlog pruning, and I believe this functionality is already provided by `ArrayDataBuilder`


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