You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "liamzwbao (via GitHub)" <gi...@apache.org> on 2026/06/22 05:21:21 UTC
[PR] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
liamzwbao opened a new pull request, #10176:
URL: https://github.com/apache/arrow-rs/pull/10176
# 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 #9298.
# 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.
-->
Replaces several `ArrayDataBuilder` paths in `arrow-select/src/filter.rs` with direct typed array constructors.
# 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.
-->
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.
-->
No
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#discussion_r3451701394
##########
arrow-select/src/take.rs:
##########
@@ -256,11 +256,18 @@ fn take_impl<IndexType: ArrowPrimitiveType>(
*length as u32,
)?))
}
- DataType::Map(_, _) => {
+ DataType::Map(field, ordered) => {
let list_arr = ListArray::from(values.as_map().clone());
let list_data = take_list::<_, Int32Type>(&list_arr, indices)?;
- let builder = list_data.into_data().into_builder().data_type(values.data_type().clone());
- Ok(Arc::new(MapArray::from(unsafe { builder.build_unchecked() })))
+ let (_, offsets, entries, nulls) = list_data.into_parts();
+ let entries = entries.as_struct().clone();
+ Ok(Arc::new(MapArray::try_new(
Review Comment:
i suppose the checks inside `try_new` are cheap enough to not be too much of an impact 👍
##########
arrow-select/src/take.rs:
##########
@@ -710,18 +717,15 @@ where
"New offsets was filled under/over the expected capacity"
);
- let child_data = array_data.freeze();
- let value_offsets = Buffer::from_vec(new_offsets);
-
- let list_data = ArrayDataBuilder::new(values.data_type().clone())
- .len(indices.len())
- .nulls(nulls)
- .offset(0)
- .add_child_data(child_data)
- .add_buffer(value_offsets);
+ let field = match values.data_type() {
+ DataType::List(field) | DataType::LargeList(field) => field.clone(),
+ d => unreachable!("take_list called with non-list data type {d}"),
+ };
+ // SAFETY: `new_offsets` is constructed to be monotonically increasing above
+ let offsets = unsafe { OffsetBuffer::new_unchecked(ScalarBuffer::from(new_offsets)) };
+ let child = make_array(array_data.freeze());
- let list_data = unsafe { list_data.build_unchecked() };
- Ok(GenericListArray::<OffsetType::Native>::from(list_data))
+ GenericListArray::<OffsetType::Native>::try_new(field, offsets, child, nulls)
Review Comment:
same 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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767589858
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767567186)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4767567186-605-g4nvd 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing issue-9298-take-array-data (e2aa396832fd6aa67b7b25cf1187842368c9f442) to b79d20d (merge-base) [diff](https://github.com/apache/arrow-rs/compare/b79d20d63990a72d176f2747e7422a8d1cf52a6e..e2aa396832fd6aa67b7b25cf1187842368c9f442)
BENCH_NAME=take_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench take_kernels
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767841399
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767722033)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group issue-9298-take-array-data main
----- -------------------------- ----
take bool 1024 1.00 1033.3±1.02ns ? ?/sec 1.01 1042.4±1.03ns ? ?/sec
take bool 512 1.00 574.3±0.40ns ? ?/sec 1.00 575.3±1.03ns ? ?/sec
take bool null indices 1024 1.05 892.0±1.19ns ? ?/sec 1.00 851.8±31.44ns ? ?/sec
take bool null values 1024 1.00 2.0±0.00µs ? ?/sec 1.00 2.0±0.00µs ? ?/sec
take bool null values null indices 1024 1.00 1613.9±15.55ns ? ?/sec 1.00 1619.3±15.99ns ? ?/sec
take check bounds i32 1024 1.00 580.8±0.71ns ? ?/sec 1.15 666.2±1.24ns ? ?/sec
take check bounds i32 512 1.00 378.5±1.20ns ? ?/sec 1.03 389.9±0.60ns ? ?/sec
take fsb value len: 12, indices: 1024 1.00 2.5±0.00µs ? ?/sec 1.04 2.6±0.00µs ? ?/sec
take fsb value len: 12, null values, indices: 1024 1.00 3.5±0.00µs ? ?/sec 1.03 3.6±0.01µs ? ?/sec
take fsb value optimized len: 16, indices: 1024 1.00 586.1±0.87ns ? ?/sec 1.17 686.5±1.67ns ? ?/sec
take fsb value optimized len: 16, null values, indices: 1024 1.00 1602.1±1.14ns ? ?/sec 1.10 1755.4±2.98ns ? ?/sec
take i32 1024 1.00 511.5±0.95ns ? ?/sec 1.02 522.6±3.23ns ? ?/sec
take i32 512 1.00 351.5±1.00ns ? ?/sec 1.01 356.7±3.44ns ? ?/sec
take i32 null indices 1024 1.00 853.3±1.02ns ? ?/sec 1.01 859.5±1.41ns ? ?/sec
take i32 null values 1024 1.00 1542.1±1.61ns ? ?/sec 1.00 1548.1±1.09ns ? ?/sec
take i32 null values null indices 1024 1.00 1717.0±1.90ns ? ?/sec 1.01 1728.8±3.48ns ? ?/sec
take list i32 1024 1.01 7.8±0.04µs ? ?/sec 1.00 7.8±0.04µs ? ?/sec
take list i32 512 1.00 4.2±0.02µs ? ?/sec 1.01 4.3±0.02µs ? ?/sec
take list i32 null indices 1024 1.00 9.6±0.12µs ? ?/sec 1.01 9.7±0.07µs ? ?/sec
take list i32 null values 1024 1.00 5.6±0.03µs ? ?/sec 1.03 5.7±0.01µs ? ?/sec
take list i32 null values null indices 1024 1.00 6.8±0.10µs ? ?/sec 1.03 7.0±0.08µs ? ?/sec
take listview i32 1024 1.00 974.5±2.36ns ? ?/sec 1.41 1374.0±3.26ns ? ?/sec
take listview i32 512 1.00 613.3±1.63ns ? ?/sec 1.49 913.6±3.05ns ? ?/sec
take listview i32 null indices 1024 1.00 1678.2±3.81ns ? ?/sec 1.23 2.1±0.01µs ? ?/sec
take listview i32 null values 1024 1.00 2.0±0.00µs ? ?/sec 1.17 2.4±0.00µs ? ?/sec
take listview i32 null values null indices 1024 1.00 2.5±0.00µs ? ?/sec 1.16 2.9±0.00µs ? ?/sec
take primitive run logical len: 1024, physical len: 512, indices: 1024 1.00 15.6±0.02µs ? ?/sec 1.01 15.8±0.02µs ? ?/sec
take str 1024 1.00 8.1±0.00µs ? ?/sec 1.02 8.3±0.05µs ? ?/sec
take str 512 1.00 3.7±0.00µs ? ?/sec 1.02 3.8±0.00µs ? ?/sec
take str null indices 1024 1.01 4.4±0.06µs ? ?/sec 1.00 4.4±0.05µs ? ?/sec
take str null indices 512 1.00 2.1±0.03µs ? ?/sec 1.04 2.1±0.03µs ? ?/sec
take str null values 1024 1.00 4.9±0.06µs ? ?/sec 1.00 4.9±0.05µs ? ?/sec
take str null values null indices 1024 1.06 3.4±0.02µs ? ?/sec 1.00 3.2±0.02µs ? ?/sec
take stringview 1024 1.23 914.6±5.98ns ? ?/sec 1.00 741.2±0.95ns ? ?/sec
take stringview 512 1.18 558.4±5.86ns ? ?/sec 1.00 471.4±0.95ns ? ?/sec
take stringview null indices 1024 1.01 996.2±3.39ns ? ?/sec 1.00 983.7±2.22ns ? ?/sec
take stringview null indices 512 1.01 572.9±2.78ns ? ?/sec 1.00 564.8±1.38ns ? ?/sec
take stringview null values 1024 1.08 1970.8±2.78ns ? ?/sec 1.00 1818.6±3.08ns ? ?/sec
take stringview null values null indices 1024 1.03 1782.4±1.47ns ? ?/sec 1.00 1729.4±3.22ns ? ?/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 370.1s |
| Peak memory | 14.7 MiB |
| Avg memory | 12.1 MiB |
| CPU user | 368.0s |
| CPU sys | 0.0s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 375.1s |
| Peak memory | 14.4 MiB |
| Avg memory | 12.4 MiB |
| CPU user | 369.4s |
| CPU sys | 0.0s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4833200501
> Same as above. There is no new_unchecked for GenericListArray, and try_new here is all O(1) checks
It would probably be nice to have GenericListArray::new_unchecked and MapArray::new_unchecked for consistency
Thank you @liamzwbao and @Jefffrey
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767896535
there seems to be an impact on stringview benchmark 🤔
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#discussion_r3453293809
##########
arrow-select/src/take.rs:
##########
@@ -256,11 +256,18 @@ fn take_impl<IndexType: ArrowPrimitiveType>(
*length as u32,
)?))
}
- DataType::Map(_, _) => {
+ DataType::Map(field, ordered) => {
let list_arr = ListArray::from(values.as_map().clone());
let list_data = take_list::<_, Int32Type>(&list_arr, indices)?;
- let builder = list_data.into_data().into_builder().data_type(values.data_type().clone());
- Ok(Arc::new(MapArray::from(unsafe { builder.build_unchecked() })))
+ let (_, offsets, entries, nulls) = list_data.into_parts();
+ let entries = entries.as_struct().clone();
+ Ok(Arc::new(MapArray::try_new(
Review Comment:
(can do as a follow on 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
Re: [PR] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "liamzwbao (via GitHub)" <gi...@apache.org>.
liamzwbao commented on code in PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#discussion_r3486435304
##########
arrow-select/src/take.rs:
##########
@@ -710,18 +717,15 @@ where
"New offsets was filled under/over the expected capacity"
);
- let child_data = array_data.freeze();
- let value_offsets = Buffer::from_vec(new_offsets);
-
- let list_data = ArrayDataBuilder::new(values.data_type().clone())
- .len(indices.len())
- .nulls(nulls)
- .offset(0)
- .add_child_data(child_data)
- .add_buffer(value_offsets);
+ let field = match values.data_type() {
+ DataType::List(field) | DataType::LargeList(field) => field.clone(),
+ d => unreachable!("take_list called with non-list data type {d}"),
+ };
+ // SAFETY: `new_offsets` is constructed to be monotonically increasing above
+ let offsets = unsafe { OffsetBuffer::new_unchecked(ScalarBuffer::from(new_offsets)) };
+ let child = make_array(array_data.freeze());
- let list_data = unsafe { list_data.build_unchecked() };
- Ok(GenericListArray::<OffsetType::Native>::from(list_data))
+ GenericListArray::<OffsetType::Native>::try_new(field, offsets, child, nulls)
Review Comment:
Same as above. There is no `new_unchecked` for `GenericListArray`, and `try_new` here is all O(1) checks
##########
arrow-select/src/take.rs:
##########
@@ -256,11 +256,18 @@ fn take_impl<IndexType: ArrowPrimitiveType>(
*length as u32,
)?))
}
- DataType::Map(_, _) => {
+ DataType::Map(field, ordered) => {
let list_arr = ListArray::from(values.as_map().clone());
let list_data = take_list::<_, Int32Type>(&list_arr, indices)?;
- let builder = list_data.into_data().into_builder().data_type(values.data_type().clone());
- Ok(Arc::new(MapArray::from(unsafe { builder.build_unchecked() })))
+ let (_, offsets, entries, nulls) = list_data.into_parts();
+ let entries = entries.as_struct().clone();
+ Ok(Arc::new(MapArray::try_new(
Review Comment:
There is no `new_unchecked` for `MapArray`. `try_new` here is all O(1) checks so I think it should be good. We could support `new_unchecked` tho
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4821752532
thanks @liamzwbao & @alamb
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767567186
run benchmark take_kernels
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767696108
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767567186)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group issue-9298-take-array-data main
----- -------------------------- ----
take bool 1024 1.00 1033.2±0.67ns ? ?/sec 1.01 1039.2±0.93ns ? ?/sec
take bool 512 1.00 573.3±0.60ns ? ?/sec 1.01 577.0±0.60ns ? ?/sec
take bool null indices 1024 1.07 913.5±6.97ns ? ?/sec 1.00 855.3±32.20ns ? ?/sec
take bool null values 1024 1.00 2.0±0.00µs ? ?/sec 1.00 2.0±0.00µs ? ?/sec
take bool null values null indices 1024 1.00 1609.3±13.50ns ? ?/sec 1.00 1607.6±19.21ns ? ?/sec
take check bounds i32 1024 1.00 583.6±1.75ns ? ?/sec 1.13 662.4±2.62ns ? ?/sec
take check bounds i32 512 1.00 379.1±0.41ns ? ?/sec 1.02 386.9±4.52ns ? ?/sec
take fsb value len: 12, indices: 1024 1.00 2.5±0.00µs ? ?/sec 1.05 2.6±0.00µs ? ?/sec
take fsb value len: 12, null values, indices: 1024 1.00 3.5±0.01µs ? ?/sec 1.04 3.7±0.00µs ? ?/sec
take fsb value optimized len: 16, indices: 1024 1.00 587.6±0.70ns ? ?/sec 1.18 691.9±3.73ns ? ?/sec
take fsb value optimized len: 16, null values, indices: 1024 1.00 1605.6±1.53ns ? ?/sec 1.09 1744.0±3.97ns ? ?/sec
take i32 1024 1.00 514.1±2.51ns ? ?/sec 1.01 521.7±4.64ns ? ?/sec
take i32 512 1.00 356.1±4.25ns ? ?/sec 1.01 358.3±6.58ns ? ?/sec
take i32 null indices 1024 1.00 853.9±1.12ns ? ?/sec 1.00 857.2±1.30ns ? ?/sec
take i32 null values 1024 1.00 1541.2±2.97ns ? ?/sec 1.01 1551.0±1.60ns ? ?/sec
take i32 null values null indices 1024 1.00 1716.3±1.59ns ? ?/sec 1.01 1732.1±2.18ns ? ?/sec
take list i32 1024 1.01 7.9±0.02µs ? ?/sec 1.00 7.8±0.02µs ? ?/sec
take list i32 512 1.00 4.1±0.01µs ? ?/sec 1.03 4.3±0.02µs ? ?/sec
take list i32 null indices 1024 1.00 9.5±0.10µs ? ?/sec 1.01 9.6±0.06µs ? ?/sec
take list i32 null values 1024 1.00 5.7±0.02µs ? ?/sec 1.01 5.8±0.02µs ? ?/sec
take list i32 null values null indices 1024 1.00 6.7±0.12µs ? ?/sec 1.03 6.9±0.10µs ? ?/sec
take listview i32 1024 1.00 1063.6±5.43ns ? ?/sec 1.26 1343.2±2.63ns ? ?/sec
take listview i32 512 1.00 615.1±1.67ns ? ?/sec 1.58 971.4±2.71ns ? ?/sec
take listview i32 null indices 1024 1.00 1598.9±1.99ns ? ?/sec 1.24 1987.5±4.05ns ? ?/sec
take listview i32 null values 1024 1.00 2.1±0.00µs ? ?/sec 1.13 2.3±0.00µs ? ?/sec
take listview i32 null values null indices 1024 1.00 2.4±0.01µs ? ?/sec 1.18 2.9±0.00µs ? ?/sec
take primitive run logical len: 1024, physical len: 512, indices: 1024 1.00 15.6±0.01µs ? ?/sec 1.02 15.8±0.01µs ? ?/sec
take str 1024 1.00 8.1±0.01µs ? ?/sec 1.00 8.1±0.01µs ? ?/sec
take str 512 1.00 3.7±0.00µs ? ?/sec 1.03 3.8±0.00µs ? ?/sec
take str null indices 1024 1.00 4.4±0.06µs ? ?/sec 1.01 4.4±0.07µs ? ?/sec
take str null indices 512 1.01 2.1±0.03µs ? ?/sec 1.00 2.0±0.04µs ? ?/sec
take str null values 1024 1.00 4.9±0.05µs ? ?/sec 1.03 5.0±0.06µs ? ?/sec
take str null values null indices 1024 1.04 3.3±0.02µs ? ?/sec 1.00 3.2±0.02µs ? ?/sec
take stringview 1024 1.25 918.0±2.22ns ? ?/sec 1.00 734.6±0.56ns ? ?/sec
take stringview 512 1.17 555.6±1.25ns ? ?/sec 1.00 473.7±1.75ns ? ?/sec
take stringview null indices 1024 1.00 922.7±2.81ns ? ?/sec 1.07 984.7±1.92ns ? ?/sec
take stringview null indices 512 1.01 571.3±1.43ns ? ?/sec 1.00 564.7±1.12ns ? ?/sec
take stringview null values 1024 1.08 1956.7±2.23ns ? ?/sec 1.00 1809.6±2.64ns ? ?/sec
take stringview null values null indices 1024 1.00 1764.5±1.89ns ? ?/sec 1.00 1760.4±2.91ns ? ?/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 370.1s |
| Peak memory | 14.8 MiB |
| Avg memory | 12.2 MiB |
| CPU user | 367.9s |
| CPU sys | 0.0s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 365.1s |
| Peak memory | 14.4 MiB |
| Avg memory | 12.6 MiB |
| CPU user | 363.4s |
| CPU sys | 0.1s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4769895950
i mistook genericlistview in the diff for stringview 😅
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#discussion_r3451701394
##########
arrow-select/src/take.rs:
##########
@@ -256,11 +256,18 @@ fn take_impl<IndexType: ArrowPrimitiveType>(
*length as u32,
)?))
}
- DataType::Map(_, _) => {
+ DataType::Map(field, ordered) => {
let list_arr = ListArray::from(values.as_map().clone());
let list_data = take_list::<_, Int32Type>(&list_arr, indices)?;
- let builder = list_data.into_data().into_builder().data_type(values.data_type().clone());
- Ok(Arc::new(MapArray::from(unsafe { builder.build_unchecked() })))
+ let (_, offsets, entries, nulls) = list_data.into_parts();
+ let entries = entries.as_struct().clone();
+ Ok(Arc::new(MapArray::try_new(
Review Comment:
i suppose the checks inside `try_new` are cheap enough to not be too much of an impact 👍
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "liamzwbao (via GitHub)" <gi...@apache.org>.
liamzwbao commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4765285484
Hi @alamb, this PR is ready for review. Would appreciate a benchmark on `take_kernels`
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#discussion_r3453262638
##########
arrow-select/src/take.rs:
##########
@@ -256,11 +256,18 @@ fn take_impl<IndexType: ArrowPrimitiveType>(
*length as u32,
)?))
}
- DataType::Map(_, _) => {
+ DataType::Map(field, ordered) => {
let list_arr = ListArray::from(values.as_map().clone());
let list_data = take_list::<_, Int32Type>(&list_arr, indices)?;
- let builder = list_data.into_data().into_builder().data_type(values.data_type().clone());
- Ok(Arc::new(MapArray::from(unsafe { builder.build_unchecked() })))
+ let (_, offsets, entries, nulls) = list_data.into_parts();
+ let entries = entries.as_struct().clone();
+ Ok(Arc::new(MapArray::try_new(
Review Comment:
I suggest we switch back to `MapArray::new_unchecked`
##########
arrow-select/src/take.rs:
##########
@@ -710,18 +717,15 @@ where
"New offsets was filled under/over the expected capacity"
);
- let child_data = array_data.freeze();
- let value_offsets = Buffer::from_vec(new_offsets);
-
- let list_data = ArrayDataBuilder::new(values.data_type().clone())
- .len(indices.len())
- .nulls(nulls)
- .offset(0)
- .add_child_data(child_data)
- .add_buffer(value_offsets);
+ let field = match values.data_type() {
+ DataType::List(field) | DataType::LargeList(field) => field.clone(),
+ d => unreachable!("take_list called with non-list data type {d}"),
+ };
+ // SAFETY: `new_offsets` is constructed to be monotonically increasing above
+ let offsets = unsafe { OffsetBuffer::new_unchecked(ScalarBuffer::from(new_offsets)) };
+ let child = make_array(array_data.freeze());
- let list_data = unsafe { list_data.build_unchecked() };
- Ok(GenericListArray::<OffsetType::Native>::from(list_data))
+ GenericListArray::<OffsetType::Native>::try_new(field, offsets, child, nulls)
Review Comment:
yeah, as above I think we should use `new_unchecked`
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767746830
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767722033)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4767722033-606-mxp7z 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing issue-9298-take-array-data (e2aa396832fd6aa67b7b25cf1187842368c9f442) to b79d20d (merge-base) [diff](https://github.com/apache/arrow-rs/compare/b79d20d63990a72d176f2747e7422a8d1cf52a6e..e2aa396832fd6aa67b7b25cf1187842368c9f442)
BENCH_NAME=take_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench take_kernels
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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] [arrow-select] perf: Replace `ArrayData` with direct `Array` construction in take kernels [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10176:
URL: https://github.com/apache/arrow-rs/pull/10176#issuecomment-4767722033
run benchmark take_kernels
--
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