You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "rluvaton (via GitHub)" <gi...@apache.org> on 2026/05/17 16:43:48 UTC
[PR] feat: add `ArrayData::new_default` [arrow-rs]
rluvaton opened a new pull request, #9988:
URL: https://github.com/apache/arrow-rs/pull/9988
TODO - fill the pr desc
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
-->
- Closes #NNN.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
If this PR claims a performance improvement, please include evidence such as benchmark results.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
If there are any breaking changes to public APIs, please call them out.
-->
--
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: [PR] feat: add `ArrayData::new_default` and change `ArrayData::new_null` for `Struct` and `FixedSizeList` to not have nulls in the children [arrow-rs]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #9988: feat: add `ArrayData::new_default` and change `ArrayData::new_null` for `Struct` and `FixedSizeList` to not have nulls in the children
URL: https://github.com/apache/arrow-rs/pull/9988
--
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: [PR] feat: add `ArrayData::new_default` and change `ArrayData::new_null` for `Struct` and `FixedSizeList` to not have nulls in the children [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #9988:
URL: https://github.com/apache/arrow-rs/pull/9988#discussion_r3486910743
##########
arrow-data/src/data.rs:
##########
@@ -791,6 +794,179 @@ impl ArrayData {
unsafe { builder.build_unchecked() }
}
+ /// Returns a new [`ArrayData`] valid for `data_type` containing `len`
+ /// default (non-null) values.
+ ///
+ /// Unlike [`Self::new_null`], the returned array never has a null mask;
+ /// its values are the zero / empty representation for the type:
+ ///
+ /// * primitive types: a zeroed values buffer (e.g. `0` for ints, `0.0` for floats)
+ /// * `Boolean`: a zeroed bitmap (all `false`)
+ /// * `Binary` / `Utf8` / `LargeBinary` / `LargeUtf8` / view variants: empty
+ /// byte slices
+ /// * `FixedSizeBinary(n)`: `n` zero bytes per element
+ /// * `List` / `LargeList` / `Map` / `ListView` / `LargeListView`: empty inner
+ /// lists (offsets/sizes all zero, child is empty)
+ /// * `FixedSizeList`: recursively default-filled child of length `list_len * len`
+ /// * `Struct`: each child field is recursively default-filled
+ /// * `Union`: in `Sparse` mode every child is default-filled; in `Dense` mode
+ /// only the first child is default-filled and the rest are empty
+ /// * `RunEndEncoded`: a single run of `len` default values
+ /// * `Dictionary`: keys all point to index `0`, which holds a single
+ /// default value (or no values, if `len == 0`)
+ pub fn new_default(data_type: &DataType, len: usize) -> Self {
Review Comment:
i do wonder about having this as a new public api, as it seems a bit of a niche usecase 🤔
how often would users need an array that is initialized to "default" values?
--
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: [PR] feat: add `ArrayData::new_default` and change `ArrayData::new_null` for `Struct` and `FixedSizeList` to not have nulls in the children [arrow-rs]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9988:
URL: https://github.com/apache/arrow-rs/pull/9988#issuecomment-5433906253
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.
--
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