You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/01/09 21:23:29 UTC
[PR] perf: Avoid ArrayData allocation in PrimitiveArray::reinterpret_cast [arrow-rs]
alamb opened a new pull request, #9129:
URL: https://github.com/apache/arrow-rs/pull/9129
# Which issue does this PR close?
- part of https://github.com/apache/arrow-rs/issues/9128
# Rationale for this change
While studying / profiling the Parquet reader I have noticed several places where unecessary allocations are happening
# What changes are included in this PR?
Avoid ArrayData allocation in `PrimitiveArray::reinterpret_cast`
# 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)?
-->
# 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] perf: Avoid ArrayData allocation in PrimitiveArray::reinterpret_cast [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #9129:
URL: https://github.com/apache/arrow-rs/pull/9129#issuecomment-3734487908
Thanks @Jefffrey and @scovich
--
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] perf: Avoid ArrayData allocation in PrimitiveArray::reinterpret_cast [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9129:
URL: https://github.com/apache/arrow-rs/pull/9129#discussion_r2677663601
##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -859,11 +859,9 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
where
K: ArrowPrimitiveType<Native = T::Native>,
{
- let d = self.to_data().into_builder().data_type(K::DATA_TYPE);
-
// SAFETY:
// Native type is the same
- PrimitiveArray::from(unsafe { d.build_unchecked() })
+ PrimitiveArray::new(self.values.clone(), self.nulls.clone())
Review Comment:
Bonus points that it removes some `unsafe`
--
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] perf: Avoid ArrayData allocation in PrimitiveArray::reinterpret_cast [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #9129:
URL: https://github.com/apache/arrow-rs/pull/9129
--
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