Skip to content

perf: speed up non-null dictionary hash scatter - #27025

Open
Rich-T-kid wants to merge 12 commits into
apache:mainfrom
Rich-T-kid:rich-T-kid/non-null-dictionary-hash-scatter
Open

Rich-T-kid wants to merge 12 commits into
apache:mainfrom
Rich-T-kid:rich-T-kid/non-null-dictionary-hash-scatter

Conversation

@Rich-T-kid

@Rich-T-kid Rich-T-kid commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Part of #26848. This is the non-null path; #26966 handles nullable keys.

Why

For a dictionary with non-null keys and values, scattering hashes overwrites every output row. with_hashes was still zeroing its reusable 8,192-row buffer first, and the scatter loop loaded and stored each row before starting the next key-indexed load.

What changed

with_hashes now keeps the initialized buffer contents when the first column is a non-null dictionary, since that column replaces every slot. The non-null scatter loop gathers eight dictionary hashes before updating the output, which gives the CPU independent loads to overlap.

Nullable keys or values continue through the existing path. Short hash buffers also keep the existing truncation behavior.

Results

Run 1 · Run 2

Skip clearing the reusable hash buffer when a dictionary with non-null keys and values will overwrite every row. Gather dictionary hashes in independent lane groups so the CPU can overlap the key-indexed loads.
@github-actions github-actions Bot added the common Related to common crate label Nov 3, 2026
@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6592499441-4263-ftkpf 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (8c0a4ee) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (8c0a4ee) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.02µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.01µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 95.0s
Peak memory 31.5 MiB
Avg memory 5.1 MiB
CPU user 23.7s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 90.0s
Peak memory 29.4 MiB
Avg memory 5.0 MiB
CPU user 23.5s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

Hi @Rich-T-kid, your benchmark configuration could not be parsed (#27025 (comment)).

Error: invalid configuration: unknown field BENCH_FILTER, expected one of env, baseline, changed, resources, shards at line 2 column 1

Usage:

run benchmark <name>           # run specific benchmark(s)
run benchmarks                 # run default suite
run benchmarks <name1> <name2> # run specific benchmarks

Any benchmark name is accepted: bench.sh suite names (e.g. tpch, clickbench_partitioned, wide_schema) and Criterion bench targets (e.g. sql_planner) are resolved automatically. A name that matches neither fails on the runner.

Per-side configuration (run benchmark tpch followed by):

env:
# shared env is inherited by BOTH the build and the run, so build
# flags go here. Builds default to no debuginfo for speed; opt back
# in for hung-job gdb dumps and cap jobs to stay within memory:
CARGO_PROFILE_RELEASE_DEBUG: "1"
CARGO_BUILD_JOBS: "1"
baseline:
ref: v45.0.0
env:
# per-side env only reaches the benchmark run, not the build
DATAFUSION_RUNTIME_MEMORY_LIMIT: 1G
changed:
ref: v46.0.0
env:
DATAFUSION_RUNTIME_MEMORY_LIMIT: 2G

Pod size and CPU architecture (each key is optional and keeps the default when absent; requests and limits are set equal):

resources:
cpu: "16"
memory: "128Gi"
arch: arm64          # arm64 or amd64

Independent benchmark shards (optional; 1–8, default 1):

run benchmark arrow_writer
shards: 4

Each shard builds both revisions, measures its assigned cases, and posts its own report. Resources and the job deadline apply per shard. DataFusion requests specifying a shard count greater than 1 fail with an error. Omit shards or use shards: 1 for DataFusion.


File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6593384459-4264-fb8ds 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (8c0a4ee) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (8c0a4ee) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.01µs        ? ?/sec    1.00     10.0±0.02µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.15      3.3±0.02µs        ? ?/sec    1.00      2.8±0.06µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 65.0s
Peak memory 35.3 MiB
Avg memory 7.0 MiB
CPU user 23.4s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 60.0s
Peak memory 29.9 MiB
Avg memory 7.4 MiB
CPU user 23.5s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

Existing hash utility tests cover dictionary hashing; retain a concise comment explaining the lane-gather fast path.
@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

@kumarUjjawal could you take a look 🙇

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

2 similar comments
@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@kumarUjjawal kumarUjjawal left a comment

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.

Thank you @Rich-T-kid

Left few comments please take a look.

Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6594963661-4285-fbvqw 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (cb54f47) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

Keep the buffer-reuse and scatter dispatch checks in one place, validate the unchecked lookup invariant, and cover chunk, tail, multi-column, and buffer-reuse behavior.
@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (cb54f47) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.01µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.01µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 65.0s
Peak memory 29.8 MiB
Avg memory 6.7 MiB
CPU user 21.5s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 85.0s
Peak memory 29.3 MiB
Avg memory 5.4 MiB
CPU user 23.6s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6594963493-4286-5r52q 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6594964058-4287-75g47 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

thank you for the in depth review @kumarUjjawal, I addressed all your comments! added the test back in as well if you could take another look.

re-running the benchmakrs as well

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.01µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.00µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 65.0s
Peak memory 29.2 MiB
Avg memory 6.6 MiB
CPU user 21.5s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 80.0s
Peak memory 34.4 MiB
Avg memory 5.6 MiB
CPU user 25.8s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.09     10.9±0.02µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.01µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 75.0s
Peak memory 29.0 MiB
Avg memory 6.1 MiB
CPU user 22.1s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 90.0s
Peak memory 29.3 MiB
Avg memory 4.9 MiB
CPU user 23.3s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6595334800-4301-245tt 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (c7d9b3a) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.01µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.01µs        ? ?/sec    1.00      2.8±0.01µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 65.0s
Peak memory 36.6 MiB
Avg memory 7.0 MiB
CPU user 24.8s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 60.0s
Peak memory 29.2 MiB
Avg memory 7.3 MiB
CPU user 23.5s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (90f551c) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.09     10.8±0.02µs        ? ?/sec    1.00      9.9±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.00µs        ? ?/sec    1.00      2.8±0.01µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 70.0s
Peak memory 29.6 MiB
Avg memory 6.3 MiB
CPU user 21.2s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 85.0s
Peak memory 29.3 MiB
Avg memory 5.4 MiB
CPU user 23.6s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (90f551c) to 198ab43 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.8±0.01µs        ? ?/sec    1.00     10.0±0.02µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.2±0.01µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 70.0s
Peak memory 35.5 MiB
Avg memory 6.6 MiB
CPU user 23.4s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 65.0s
Peak memory 31.9 MiB
Avg memory 7.1 MiB
CPU user 24.9s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid
Rich-T-kid marked this pull request as draft November 8, 2026 19:19
@Rich-T-kid
Rich-T-kid marked this pull request as ready for review November 12, 2026 17:48
@Rich-T-kid

Rich-T-kid commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

this is ready for review again @kumarUjjawal 🙇

Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Use one physical-null predicate for buffer reuse and scatter dispatch, keep collision builds conservative, enforce the unchecked gather bounds in release builds, and cover sliced u8/u16/i64 dictionaries.
@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6858853791-4962-bnnhl 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (1150cfc) to 4c7b307 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (1150cfc) to 4c7b307 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.09     10.9±0.04µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.3±0.00µs        ? ?/sec    1.00      2.8±0.01µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 90.0s
Peak memory 29.0 MiB
Avg memory 4.9 MiB
CPU user 21.6s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 85.0s
Peak memory 28.8 MiB
Avg memory 5.4 MiB
CPU user 23.6s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

show benchmark queue

@adriangbot

Copy link
Copy Markdown

Hi @Rich-T-kid, you asked to view the benchmark queue (#27025 (comment)).

Comment Repo PR User Benchmarks Resources Status
#6858430099 apache/arrow-rs #11973 Rich-T-kid ["zip_kernels"] default running
#6858431183 apache/arrow-rs #11973 Rich-T-kid ["merge_kernels"] default running
#6859107075 apache/arrow-rs #11973 Rich-T-kid ["interleave_kernels"] default running
#6859110127 apache/arrow-rs #11973 Rich-T-kid ["zip_kernels"] default running
#6859109055 apache/arrow-rs #11973 Rich-T-kid ["filter_kernels"] default running
#6859110975 apache/arrow-rs #11973 Rich-T-kid ["merge_kernels"] default pending
#6859299632 apache/datafusion #27025 Rich-T-kid ["with_hashes"] default pending
#6859512678 apache/arrow-rs #11973 Rich-T-kid ["concatenate_kernel"] default pending
#6859596521 apache/arrow-rs #11973 Rich-T-kid ["mutable_array"] default pending
#6859852734 apache/arrow-rs #12218 Rich-T-kid ["coalesce_kernels"] default pending
#6859851870 apache/arrow-rs #12218 Rich-T-kid ["coalesce_kernels"] amd64 pending

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6859299632-4970-rzclf 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (1150cfc) to 4c7b307 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (1150cfc) to 4c7b307 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.08     10.9±0.01µs        ? ?/sec    1.00     10.0±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.16      3.3±0.01µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 65.0s
Peak memory 28.1 MiB
Avg memory 6.5 MiB
CPU user 21.7s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 60.0s
Peak memory 28.7 MiB
Avg memory 7.1 MiB
CPU user 23.4s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
Comment thread datafusion/common/src/hash_utils.rs Resolved
@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

run benchmark with_hashes
env:
BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6953988508-5330-bdgk7 6.12.105+ #1 SMP Sat Sep 19 07:55:25 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 rich-T-kid/non-null-dictionary-hash-scatter (286f893) to cdc3bf7 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing rich-T-kid/non-null-dictionary-hash-scatter (286f893) to cdc3bf7 (merge-base) diff

Run configuration
run benchmark with_hashes
env:
  BENCH_FILTER: "dictionary_utf8_int32.*no nulls"
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                                        HEAD                                   rich-T-kid_non-null-dictionary-hash-scatter
-----                                        ----                                   -------------------------------------------
dictionary_utf8_int32: multiple, no nulls    1.06     10.9±0.01µs        ? ?/sec    1.00     10.3±0.01µs        ? ?/sec
dictionary_utf8_int32: single, no nulls      1.17      3.3±0.02µs        ? ?/sec    1.00      2.8±0.00µs        ? ?/sec

Resource Usage

with_hashes — base (merge-base)

Metric Value
Wall time 205.0s
Peak memory 28.5 MiB
Avg memory 2.1 MiB
CPU user 21.8s
CPU sys 0.0s
Peak spill 0 B

with_hashes — branch

Metric Value
Wall time 190.0s
Peak memory 30.4 MiB
Avg memory 2.5 MiB
CPU user 23.6s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

Comment thread datafusion/common/src/hash_utils.rs Outdated

// Oversized dictionaries are compacted before scattering. Only inspect
// logical nulls when compaction can remove all unreferenced null values.
array.values().len() > MAX_DICTIONARY_VALUES_PER_ROW * array.len()

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.

No test covers the new logical_null_count() == 0 guard on the oversized-dictionary reuse branch. Deleting it, which lets with_hashes skip clear() when a key references a null value, would not fail any test.**

Failure scenario: Edit line 125 to drop && array.logical_null_count() == 0, then run with_hashes on a 1-row dictionary with key [0] and values [None, ...65 strings] after dirty_hash_buffer. The gate returns true and the buffer is not cleared. The compacted dictionary still has a null value, so the null-values scatter skips that row, and the callback receives u64::MAX instead of the null hash. The only oversized test (test_dictionary_with_unreferenced_null_reuses_buffer) references a non-null value. The null_values case in assert_matches is not oversized (3 values <= 64*11 rows), so the && short-circuits before reaching the check. Nothing fails.

Comment thread datafusion/common/src/hash_utils.rs Outdated
// Oversized dictionaries are compacted before scattering. Only inspect
// logical nulls when compaction can remove all unreferenced null values.
array.values().len() > MAX_DICTIONARY_VALUES_PER_ROW * array.len()
&& array.logical_null_count() == 0

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.

The reuse gate again uses a logical null test (array.logical_null_count()), while the scatter dispatch uses physical null_count (dictionary_nulls).

Failure scenario: Whether with_hashes may skip clear() again depends on two different null predicates staying consistent: logical nulls of the uncompacted dictionary versus physical null_count of the compacted one. A later change to arrow's logical_nulls for some value type, or to compact_dictionary, can make the gate return true while dispatch takes a null path that leaves slots unwritten. Callers would then get the previous batch's hashes. This is the same coupling kumarUjjawal flagged.

Comment thread datafusion/common/src/hash_utils.rs Outdated
// Oversized dictionaries are compacted before scattering. Only inspect
// logical nulls when compaction can remove all unreferenced null values.
array.values().len() > MAX_DICTIONARY_VALUES_PER_ROW * array.len()
&& array.logical_null_count() == 0

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.

logical_null_count() builds a full validity bitmap for the dictionary on every with_hashes call just to get one boolean, and for nested-dictionary values it walks every value.

Failure scenario: Take a sliced 8192-row dictionary whose values array has nulls and holds about 1M entries, which is the oversized case this branch targets. DictionaryArray::logical_nulls allocates a BooleanBufferBuilder for all rows and probes every key, and compact_oversized_dictionary then repeats an O(rows) pass. If the values are themselves a dictionary with null keys, values.logical_nulls() iterates all ~1M inner keys per batch, the very work compaction exists to avoid. This can cost more than the 64KB memset that skipping clear() saves.

let has_null_keys = array.keys().null_count() != 0;
let has_null_values = array.values().null_count() != 0;
// `create_hashes` hashes the prefix selected by the output buffer length.
assert!(

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.

The dispatcher still asserts only <=, so dictionaries alone accept a shorter buffer and hash just a prefix.

Failure scenario: create_hashes([&dict], rs, &mut vec![0; dict.len() - 1]) succeeds and hashes a prefix. The same call with an Int32 or Utf8 column panics in hash_array_primitive/hash_array. The test at the short buffer case (check_non_null_dictionary_hash_fast_path) locks in this dictionary-only leniency, so the inconsistent contract the reviewer flagged is still there.

}
}

for (hash, key) in hash_tail.iter_mut().zip(key_tail) {

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.

The tail loop again copy-pastes the if MULTI_COL { combine_hashes(dict_hash, *hash) } else { dict_hash } rule, and scatter_row holds a third copy (lines 649-653).

Failure scenario: The combine rule now lives in three places: the chunk body, the tail, and scatter_row. If one copy changes, for example by swapping combine_hashes argument order, rows in the 8-lane chunks, the tail rows, and dictionaries with nulls would hash equal values differently. Hash joins and repartitioning would silently mismatch rows.

Comment thread datafusion/common/src/hash_utils.rs Outdated

// Oversized dictionaries are compacted before scattering. Only inspect
// logical nulls when compaction can remove all unreferenced null values.
array.values().len() > MAX_DICTIONARY_VALUES_PER_ROW * array.len()

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.

The gate copies compact_oversized_dictionary's threshold (values.len() > MAX_DICTIONARY_VALUES_PER_ROW * len) even though correctness does not need it.

Failure scenario: When there are no null keys and logical_null_count() == 0, the null-values scatter writes every row anyway, because every referenced value is valid. Compaction is therefore not what makes reuse safe, and the comment on lines 122-123 is misleading. Meanwhile a filtered dictionary with 100 rows and 200 values, one unreferenced null, is not oversized, so it is still cleared and takes the slower null-values path. The copied threshold also breaks silently if compact_oversized_dictionary changes, for example to the saturating_mul form used in multi_group_by.

Comment thread datafusion/common/src/hash_utils.rs Outdated
// Get the required size from the first array
let required_size = match iter.peek() {
Some(arr) => arr.as_dyn_array().len(),
// Get the required size and initialization policy from the first array

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.

we can trim the comments

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.

dispatch_dictionary_scatter(array, dict_hashes, hashes_buffer, multi_col);

scatter_dictionary_hashes, a public internal API that returns Result, now panics in release builds through the new dispatcher assert! when hashes_buffer is longer than the array. Before this change it silently stopped at the last key, and it already returns an internal error for a wrong dict_hashes length.

Failure scenario: A workspace caller passes a hashes slice sized to a batch longer than the dictionary column. Before this PR the zip stopped at keys.len(); now the whole aggregation thread panics with 'dictionary scatter requires at least one key per hash slot' instead of getting an _internal_err! it could propagate. This is a behavior change to a pub item that the PR description does not mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants