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/03/17 14:11:36 UTC
[GitHub] [arrow-rs] tustvold opened a new pull request, #3881: Add Array::to_data and Array::nulls (#3880)
tustvold opened a new pull request, #3881:
URL: https://github.com/apache/arrow-rs/pull/3881
# 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. For example `Closes #123` indicates that this PR will close issue #123.
-->
Part of #3880
# 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.
-->
In order to be able to remove `ArrayData` from inside the various `Array` abstractions, we need to tweak the `Array` interface slightly
# 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 there any user-facing changes?
This PR doesn't make any breaking changes, yet...
<!--
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 add the `breaking change` label.
-->
--
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] alamb commented on a diff in pull request #3881: Add Array::to_data and Array::nulls (#3880)
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #3881:
URL: https://github.com/apache/arrow-rs/pull/3881#discussion_r1140347193
##########
arrow-arith/src/aggregate.rs:
##########
@@ -117,7 +117,7 @@ where
.map(|i| unsafe { array.value_unchecked(i) })
.reduce(|acc, item| if cmp(&acc, &item) { item } else { acc })
} else {
- let nulls = array.data().nulls().unwrap();
+ let nulls = array.nulls().unwrap();
Review Comment:
The point of this PR, as I understand it, is to remove direct use of `data()` -- so that eventually the Arrays themselves do not need to hold `ArrayData` but rather the strongly typed variants.
The plan is not to remove ArrayData completely, but rather construct it on demand if needed from the appropriate parts of each Array
##########
arrow-array/src/array/mod.rs:
##########
@@ -96,12 +96,19 @@ pub trait Array: std::fmt::Debug + Send + Sync {
fn as_any(&self) -> &dyn Any;
/// Returns a reference to the underlying data of this array.
+ ///
+ /// This will be deprecated in a future release [(#3880)](https://github.com/apache/arrow-rs/issues/3880)
fn data(&self) -> &ArrayData;
+ /// Returns the underlying data of this array.
+ fn to_data(&self) -> ArrayData;
+
/// Returns the underlying data of this array.
fn into_data(self) -> ArrayData;
/// Returns a reference-counted pointer to the underlying data of this array.
+ ///
+ /// This will be deprecated in a future release [(#3880)](https://github.com/apache/arrow-rs/issues/3880)
Review Comment:
Should we mark it as `#[deprecated]`?
##########
arrow-array/src/array/mod.rs:
##########
@@ -96,12 +96,19 @@ pub trait Array: std::fmt::Debug + Send + Sync {
fn as_any(&self) -> &dyn Any;
/// Returns a reference to the underlying data of this array.
+ ///
+ /// This will be deprecated in a future release [(#3880)](https://github.com/apache/arrow-rs/issues/3880)
fn data(&self) -> &ArrayData;
+ /// Returns the underlying data of this array.
Review Comment:
I think some docs explaining the (subtle) difference between `to_data` and `into_data`, and what the implications of using the two APIs are would be helpful here (like `into_data` doesn't increase the underlying ref count?
--
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 a diff in pull request #3881: Add Array::to_data and Array::nulls (#3880)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3881:
URL: https://github.com/apache/arrow-rs/pull/3881#discussion_r1140358055
##########
arrow-array/src/array/mod.rs:
##########
@@ -96,12 +96,19 @@ pub trait Array: std::fmt::Debug + Send + Sync {
fn as_any(&self) -> &dyn Any;
/// Returns a reference to the underlying data of this array.
+ ///
+ /// This will be deprecated in a future release [(#3880)](https://github.com/apache/arrow-rs/issues/3880)
fn data(&self) -> &ArrayData;
+ /// Returns the underlying data of this array.
+ fn to_data(&self) -> ArrayData;
+
/// Returns the underlying data of this array.
fn into_data(self) -> ArrayData;
/// Returns a reference-counted pointer to the underlying data of this array.
+ ///
+ /// This will be deprecated in a future release [(#3880)](https://github.com/apache/arrow-rs/issues/3880)
Review Comment:
I expect to do so in a future PR, trying to avoid changing all the things at once :smile:
--
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 merged pull request #3881: Add Array::to_data and Array::nulls (#3880)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #3881:
URL: https://github.com/apache/arrow-rs/pull/3881
--
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