Skip to content

feat: extract has_false and has_true from BooleanArray to BooleanBuffer and reuse for no nulls#9987

Merged
alamb merged 4 commits into
apache:mainfrom
rluvaton:move-some-func-to-boolean-buffer
May 20, 2026
Merged

feat: extract has_false and has_true from BooleanArray to BooleanBuffer and reuse for no nulls#9987
alamb merged 4 commits into
apache:mainfrom
rluvaton:move-some-func-to-boolean-buffer

Conversation

@rluvaton
Copy link
Copy Markdown
Member

Which issue does this PR close?

N/A

Rationale for this change

So we can use the useful helpers without creating temp BooleanArray

What changes are included in this PR?

Extract non null variants for computing has_false and has_true from BooleanArray to BooleanBuffer and call them instead, and copied the tests for not nullable

Are these changes tested?

Yes

Are there any user-facing changes?

2 new functions


Cc @alamb as talked in:

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank yoU @rluvaton -- looks like a nice refactor to me

self.into_iter()
}

/// Returns an [`UnalignedBitChunk`] over this buffer's values.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice -- it just moves the code down a level (into BooleanBuffer out of BooleanArray)

@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 18, 2026

run benchmark boolean_kernels

1 similar comment
@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 18, 2026

run benchmark boolean_kernels

@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 18, 2026

@adriangbot
Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4481448653-188-2wks7 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing move-some-func-to-boolean-buffer (273da35) to fd1c5b3 (merge-base) diff
BENCH_NAME=boolean_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench boolean_kernels
BENCH_FILTER=
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4481449618-189-mh2j6 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing move-some-func-to-boolean-buffer (273da35) to fd1c5b3 (merge-base) diff
BENCH_NAME=boolean_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench boolean_kernels
BENCH_FILTER=
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
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

group            main                                   move-some-func-to-boolean-buffer
-----            ----                                   --------------------------------
and              1.00    150.7±0.76ns        ? ?/sec    1.02    154.3±2.49ns        ? ?/sec
and_sliced_1     1.00    550.2±1.19ns        ? ?/sec    1.02    559.8±1.36ns        ? ?/sec
and_sliced_24    1.00    152.4±0.64ns        ? ?/sec    1.02    155.0±2.07ns        ? ?/sec
not              1.03    112.1±0.63ns        ? ?/sec    1.00    108.8±1.61ns        ? ?/sec
not_slice_24     1.02    110.8±0.56ns        ? ?/sec    1.00    108.9±1.38ns        ? ?/sec
not_sliced_1     1.03    111.6±0.60ns        ? ?/sec    1.00    108.9±1.57ns        ? ?/sec
or               1.05    161.7±0.37ns        ? ?/sec    1.00    153.4±3.42ns        ? ?/sec
or_sliced_1      1.01    563.0±0.93ns        ? ?/sec    1.00    558.8±2.16ns        ? ?/sec
or_sliced_24     1.07    164.6±0.40ns        ? ?/sec    1.00    153.9±2.18ns        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 95.0s
Peak memory 3.0 GiB
Avg memory 3.0 GiB
CPU user 89.4s
CPU sys 0.7s
Peak spill 0 B

branch

Metric Value
Wall time 90.0s
Peak memory 3.0 GiB
Avg memory 3.0 GiB
CPU user 88.3s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
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

group            main                                   move-some-func-to-boolean-buffer
-----            ----                                   --------------------------------
and              1.02    153.1±2.01ns        ? ?/sec    1.00    150.2±0.50ns        ? ?/sec
and_sliced_1     1.00    551.2±1.36ns        ? ?/sec    1.01    557.8±1.21ns        ? ?/sec
and_sliced_24    1.00    151.9±0.84ns        ? ?/sec    1.01    152.7±0.72ns        ? ?/sec
not              1.06    113.0±1.72ns        ? ?/sec    1.00    106.5±0.52ns        ? ?/sec
not_slice_24     1.03    110.1±0.41ns        ? ?/sec    1.00    106.6±0.44ns        ? ?/sec
not_sliced_1     1.04    110.2±0.45ns        ? ?/sec    1.00    106.5±0.52ns        ? ?/sec
or               1.10    163.9±2.20ns        ? ?/sec    1.00    148.8±0.88ns        ? ?/sec
or_sliced_1      1.02    563.5±1.28ns        ? ?/sec    1.00    554.9±1.29ns        ? ?/sec
or_sliced_24     1.08    164.0±0.49ns        ? ?/sec    1.00    151.8±0.80ns        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 95.0s
Peak memory 3.0 GiB
Avg memory 3.0 GiB
CPU user 89.3s
CPU sys 0.7s
Peak spill 0 B

branch

Metric Value
Wall time 90.0s
Peak memory 3.0 GiB
Avg memory 3.0 GiB
CPU user 87.6s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 20, 2026

Merging up to pick up CI fix

@alamb alamb merged commit 39c8814 into apache:main May 20, 2026
26 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 20, 2026

Thanks again @rluvaton

@rluvaton rluvaton deleted the move-some-func-to-boolean-buffer branch May 20, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants