You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/16 15:18:53 UTC
[GitHub] [arrow-rs] tustvold opened a new pull request, #2746: Split out arrow data
tustvold opened a new pull request, #2746:
URL: https://github.com/apache/arrow-rs/pull/2746
_Draft as builds on https://github.com/apache/arrow-rs/pull/2711_
# 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 https://github.com/apache/arrow-rs/issues/2594
# 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.
-->
ArrayData represents the canonical representation of an arrow array, and is the language of the C Data interface. It therefore makes sense to split into its own crate.
# 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.
-->
Splits out ArrayData and related structures into a separate crate.
# Are there any user-facing changes?
An incredibly minor one, we can no longer implement `From<ArrayRef> for ArrayData`. In practice nothing seems to be making use of this.
<!--
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] tustvold commented on a diff in pull request #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976492732
##########
arrow-data/src/equal/boolean.rs:
##########
@@ -88,30 +88,3 @@ pub(super) fn boolean_equal(
})
}
}
-
-#[cfg(test)]
Review Comment:
These tests are moved to arrow/tests/array_equal.rs
--
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 #2746: Split out `arrow-data` into a separate crate
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976854262
##########
arrow-data/src/transform/variable_size.rs:
##########
@@ -15,31 +15,33 @@
// specific language governing permissions and limitations
// under the License.
-use crate::{
- array::{ArrayData, OffsetSizeTrait},
- buffer::MutableBuffer,
-};
+use crate::ArrayData;
+use arrow_buffer::{ArrowNativeType, MutableBuffer};
+use num::traits::AsPrimitive;
+use num::Integer;
use super::{
Extend, _MutableArrayData,
utils::{extend_offsets, get_last_offset},
};
#[inline]
-fn extend_offset_values<T: OffsetSizeTrait>(
+fn extend_offset_values<T: ArrowNativeType + AsPrimitive<usize>>(
buffer: &mut MutableBuffer,
offsets: &[T],
values: &[u8],
start: usize,
len: usize,
) {
- let start_values = offsets[start].to_usize().unwrap();
- let end_values = offsets[start + len].to_usize().unwrap();
+ let start_values = offsets[start].as_();
Review Comment:
TIL: https://docs.rs/num/latest/num/cast/trait.AsPrimitive.html#tymethod.as_
`as_()` is something I have not seen before. Fascinating.
##########
arrow/src/array/array_decimal.rs:
##########
@@ -284,7 +284,11 @@ impl<T: DecimalType> DecimalArray<T> {
// safety: self.data is valid DataType::Decimal as checked above
let new_data_type = Self::TYPE_CONSTRUCTOR(precision, scale);
- Ok(self.data().clone().with_data_type(new_data_type).into())
+ let data = self.data().clone().into_builder().data_type(new_data_type);
Review Comment:
cc @liukun4515 -- I think it is fine
##########
arrow-data/src/transform/mod.rs:
##########
@@ -0,0 +1,672 @@
+// Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
I think moving out the tests is a great idea -- I wonder if we need to do anything more to make them discoverable 🤔
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976487276
##########
arrow/src/array/array.rs:
##########
@@ -358,6 +358,90 @@ pub trait ArrayAccessor: Array {
unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}
+impl PartialEq for dyn Array {
Review Comment:
These are moved from arrow/equal/mod.rs
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976488854
##########
arrow-data/src/data.rs:
##########
@@ -1771,1124 +1746,30 @@ mod tests {
}
#[test]
- #[should_panic(
Review Comment:
These tests are moved to arrow/tests/array_validation.rs
--
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 pull request #2746: Split out `arrow-data` into a separate crate
Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#issuecomment-1254774570
This does not appear to have a discernible impact on the benchmarks - some fluctuate as is to be expected when you're talking nanoseconds, but no major change in either direction
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976485804
##########
arrow-data/src/transform/mod.rs:
##########
@@ -0,0 +1,672 @@
+// Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
This is moved from array/transform/mod.rs but with the tests split out into arrow/tests/array_transform.rs
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976493129
##########
arrow-data/src/equal/list.rs:
##########
@@ -149,52 +148,3 @@ pub(super) fn list_equal<T: OffsetSizeTrait>(
})
}
}
-
-#[cfg(test)]
Review Comment:
These tests are moved to arrow/tests/array_equal.rs
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r973142852
##########
arrow-data/src/bitmap.rs:
##########
@@ -56,6 +56,10 @@ impl Bitmap {
unsafe { bit_util::get_bit_raw(self.bits.as_ptr(), i) }
}
+ pub fn buffer(&self) -> &Buffer {
Review Comment:
I intend to deprecate buffer_ref in a follow up PR
--
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] ursabot commented on pull request #2746: Split out `arrow-data` into a separate crate
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#issuecomment-1254781078
Benchmark runs are scheduled for baseline = 80c0f1a480ee51bc05a2224108575dfad1be8deb and contender = a927d7aa8cfb47ff8ccdd6efdea9170a2d37dc62. a927d7aa8cfb47ff8ccdd6efdea9170a2d37dc62 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/67a205e739a443f49122a968eb5d53e9...a8357c6a9e124083892a72126aa9f2a3/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/9d8faba9aa724f67b59f8a75ed72ba5f...29047a7a27ac482692e7da29547ea97b/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/25c5a57582244869975952d288efcf0a...9dcb95ad90964e249366cae78d1a95e0/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/4bd519d3085b4416b05c20987fa5021a...22265cd055d04130936cbae1a45c1748/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r973140513
##########
arrow/src/array/array_decimal.rs:
##########
@@ -284,7 +284,11 @@ impl<T: DecimalType> DecimalArray<T> {
// safety: self.data is valid DataType::Decimal as checked above
let new_data_type = Self::TYPE_CONSTRUCTOR(precision, scale);
- Ok(self.data().clone().with_data_type(new_data_type).into())
+ let data = self.data().clone().into_builder().data_type(new_data_type);
Review Comment:
This method was previously pub(crate), I opted to just remove it in favour of the into_builder plumbing
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976493344
##########
arrow-data/src/equal/mod.rs:
##########
@@ -0,0 +1,171 @@
+// Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
This is moved from arrow/array/equal/mod.rs
--
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 #2746: Split out arrow data
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746#discussion_r976488048
##########
arrow/src/array/equal/mod.rs:
##########
@@ -1,1464 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
This is moved to arrow-data/equal/mod.rs with the array equality moved to arrow/array/array.rs and the tests moved to arrow/tests/array_equal.rs
--
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 #2746: Split out `arrow-data` into a separate crate
Posted by GitBox <gi...@apache.org>.
tustvold merged PR #2746:
URL: https://github.com/apache/arrow-rs/pull/2746
--
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