Skip to content

fix(arrow-data): don't panic on dictionary key overflow in interleave/concat - #10675

Merged
Jefffrey merged 3 commits into
apache:mainfrom
okhsunrog:fix-dictionary-key-overflow-panic
Aug 20, 2026
Merged

Jefffrey merged 3 commits into
apache:mainfrom
okhsunrog:fix-dictionary-key-overflow-panic

Conversation

@okhsunrog

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

interleave() and concat() document a Result return type, but for Dictionary<K, Utf8View>/Dictionary<K, BinaryView> arrays (top-level or nested inside a List/FixedSizeList/Struct/RunEndEncoded/Union), a genuine dictionary key overflow currently panics instead of returning Err. This happens because the fallback path builds a MutableArrayData directly and .expect()s the dictionary-concat result, and MutableArrayData::new/with_capacities have no fallible variant. See #10674 for the full analysis and a minimal repro.

What changes are included in this PR?

  • Add MutableArrayData::try_new / try_with_capacities, fallible variants of new / with_capacities that return Err(ArrowError::DictionaryKeyOverflowError) instead of panicking on dictionary key overflow. new()/with_capacities() keep their existing panicking behavior (now implemented as try_with_capacities(..).expect(..)) for the many existing callers that rely on infallibility.
  • Recursive child construction inside try_with_capacities (for List/LargeList/Map/ListView/LargeListView/FixedSizeList/Struct/RunEndEncoded/Union) also uses the fallible variants and propagates errors with ?, so dictionaries nested inside container types are covered, not just top-level dictionary arrays.
  • Switch arrow-select's interleave_fallback and concat_fallback (the paths reached for dictionary arrays whose values can't/shouldn't be merged) to the fallible constructors.

Are these changes tested?

Yes:

  • concat_string_view_dictionary_overflow_returns_err / test_interleave_string_view_dictionary_overflow_returns_err: top-level Dictionary<UInt8, Utf8View> overflow returns Err instead of panicking.
  • concat_nested_dictionary_overflow_returns_err / test_interleave_nested_dictionary_overflow_returns_err: same overflow nested inside a FixedSizeList, exercising the recursive child construction.

Full arrow-data/arrow-select test suites pass (410 tests), cargo fmt --check and cargo clippy --all-targets -- -D warnings are clean for both crates.

Are there any user-facing changes?

No breaking changes. MutableArrayData::new/with_capacities keep their documented panicking behavior and signatures. Two new public fallible methods are added (try_new, try_with_capacities). interleave()/concat() keep their existing Result signature -- the only visible change is that a specific previously-panicking input (genuine dictionary key overflow on Utf8View/BinaryView dictionaries) now returns Err(ArrowError::DictionaryKeyOverflowError) instead.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-select arrow-data labels Aug 13, 2026
@okhsunrog

Copy link
Copy Markdown
Contributor Author

Also probably related to #10553

@okhsunrog

Copy link
Copy Markdown
Contributor Author

@Jefffrey could you review this one please?

@Rich-T-kid Rich-T-kid 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.

This looks good to me. left a couple nits about the comments.

Comment thread arrow-data/src/transform/mod.rs Resolved
Comment thread arrow-data/src/transform/mod.rs Resolved
MutableArrayData::new / with_capacities unconditionally concatenate
dictionaries whose values aren't the same underlying buffer, and
.expect() the result. When the combined dictionary genuinely exceeds
the key type's range (e.g. merging independently dictionary-encoded
partitions with UInt16 keys), this panics instead of surfacing a
catchable error. The same construction is used recursively for
dictionaries nested inside List/FixedSizeList/Struct/RunEndEncoded/
Union children, so the panic isn't limited to top-level dictionary
arrays.

Add fallible try_new / try_with_capacities that return
Err(ArrowError::DictionaryKeyOverflowError) instead of panicking, and
switch arrow-select's interleave_fallback and concat_fallback (the
paths reached for dictionary arrays that can't/shouldn't be merged),
including their recursive descent into nested children, to use them.
new()/with_capacities() keep their existing panicking behavior for all
other callers.
@okhsunrog
okhsunrog force-pushed the fix-dictionary-key-overflow-panic branch from 07b9336 to bad60bc Compare August 17, 2026 09:45
@Jefffrey Jefffrey added the bug Squash those bugs label Aug 18, 2026
Comment on lines +415 to +418
/// Unlike [MutableArrayData::new], this does not panic when merging dictionary
/// arrays whose combined values would overflow the dictionary key type. Instead,
/// it returns an error, letting callers (e.g. [`interleave`](crate) / `concat`)
/// surface it as a normal error.

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 sufficient for this PR, but in a followup we'll likely need to modify try_with_capacities() to return errors for all its other panicking behaviour and adjust this doc to be less specific toward the dictionary overflow behaviour

Comment thread arrow-data/src/transform/mod.rs Outdated
/// of `arrays`. Or when a [Capacities] variant is not yet supported.
/// of `arrays`. Or when a [Capacities] variant is not yet supported. Or when
/// merging dictionary arrays whose combined values overflow the dictionary key
/// type — see [MutableArrayData::try_with_capacities] for a fallible variant.

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.

can list as bullet points instead of chaining or's

/// # Panics
///
/// * if given `capacities` don't match the data type of `arrays`
/// * if a `Capacities` variant is not yet supported
/// * when merging dictionary arrays whose combined values overflow the dictionary key type

Comment thread arrow-select/src/concat.rs Outdated
Comment on lines +1737 to +1751
// Two independently-built `Dictionary<UInt8, Utf8View>` arrays, each within
// the u8 key range on its own, but whose *combined* distinct values overflow
// it (analogous to per-partition dictionary-encoded columns being merged).
let values_a: StringViewArray = (0..200).map(|i| Some(format!("a{i}"))).collect();
let keys_a = UInt8Array::from_iter_values(0..200);
let dict_a = DictionaryArray::<UInt8Type>::new(keys_a, Arc::new(values_a));

let values_b: StringViewArray = (0..200).map(|i| Some(format!("b{i}"))).collect();
let keys_b = UInt8Array::from_iter_values(0..200);
let dict_b = DictionaryArray::<UInt8Type>::new(keys_b, Arc::new(values_b));

// Must not panic: the key type genuinely cannot address 400 distinct values,
// so this should surface as a normal, catchable error.
let err = concat(&[&dict_a, &dict_b]).unwrap_err();
assert!(matches!(err, ArrowError::DictionaryKeyOverflowError));

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.

Suggested change
// Two independently-built `Dictionary<UInt8, Utf8View>` arrays, each within
// the u8 key range on its own, but whose *combined* distinct values overflow
// it (analogous to per-partition dictionary-encoded columns being merged).
let values_a: StringViewArray = (0..200).map(|i| Some(format!("a{i}"))).collect();
let keys_a = UInt8Array::from_iter_values(0..200);
let dict_a = DictionaryArray::<UInt8Type>::new(keys_a, Arc::new(values_a));
let values_b: StringViewArray = (0..200).map(|i| Some(format!("b{i}"))).collect();
let keys_b = UInt8Array::from_iter_values(0..200);
let dict_b = DictionaryArray::<UInt8Type>::new(keys_b, Arc::new(values_b));
// Must not panic: the key type genuinely cannot address 400 distinct values,
// so this should surface as a normal, catchable error.
let err = concat(&[&dict_a, &dict_b]).unwrap_err();
assert!(matches!(err, ArrowError::DictionaryKeyOverflowError));
// concatenating dictionaries which results in overflowing the key type should
// surface an error not a panic
let values_a: StringViewArray = (0..200).map(|i| Some(format!("a{i}"))).collect();
let keys_a = UInt8Array::from_iter_values(0..200);
let dict_a = DictionaryArray::<UInt8Type>::new(keys_a, Arc::new(values_a));
let values_b: StringViewArray = (0..200).map(|i| Some(format!("b{i}"))).collect();
let keys_b = UInt8Array::from_iter_values(0..200);
let dict_b = DictionaryArray::<UInt8Type>::new(keys_b, Arc::new(values_b));
let err = concat(&[&dict_a, &dict_b]).unwrap_err();
assert!(matches!(err, ArrowError::DictionaryKeyOverflowError));

we can cut down the verbosity of the comments; same for the other tests below

- MutableArrayData::with_capacities's # Panics doc: bullet points
  instead of chained "or" sentences.
- Cut the verbose per-test explanatory comments down to one line each,
  matching the style of the surrounding tests.
@Jefffrey

Copy link
Copy Markdown
Contributor

run benchmarks concatenate_kernel interleave_kernels

@adriangbot

This comment was marked as duplicate.

@adriangbot

This comment was marked as duplicate.

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

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

Comparing fix-dictionary-key-overflow-panic (5f53130) to 3abbc04 (merge-base) diff

Run configuration
run benchmark concatenate_kernel
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                                                          fix-dictionary-key-overflow-panic      main
-----                                                          ---------------------------------      ----
concat 1024 arrays boolean 4                                   1.03     13.1±0.07µs        ? ?/sec    1.00     12.7±0.05µs        ? ?/sec
concat 1024 arrays i32 4                                       1.00      7.1±0.05µs        ? ?/sec    1.00      7.1±0.03µs        ? ?/sec
concat 1024 arrays str 4                                       1.00     22.8±0.10µs        ? ?/sec    1.02     23.2±0.08µs        ? ?/sec
concat boolean 1024                                            1.00    232.1±1.44ns        ? ?/sec    1.02    236.7±4.86ns        ? ?/sec
concat boolean 8192 over 100 arrays                            1.00      3.8±0.14µs        ? ?/sec    1.01      3.9±0.14µs        ? ?/sec
concat boolean nulls 1024                                      1.00    366.3±2.96ns        ? ?/sec    1.02    373.0±9.31ns        ? ?/sec
concat boolean nulls 8192 over 100 arrays                      1.00      9.5±0.15µs        ? ?/sec    1.02      9.7±0.18µs        ? ?/sec
concat fixed size lists                                        1.00    226.7±0.51µs        ? ?/sec    1.07    243.6±3.40µs        ? ?/sec
concat i32 1024                                                1.00    308.2±3.67ns        ? ?/sec    1.01    311.7±3.94ns        ? ?/sec
concat i32 8192 over 100 arrays                                1.00     93.9±0.40µs        ? ?/sec    1.09    102.5±0.57µs        ? ?/sec
concat i32 nulls 1024                                          1.00    500.2±7.39ns        ? ?/sec    1.01    504.9±4.97ns        ? ?/sec
concat i32 nulls 8192 over 100 arrays                          1.00    100.0±0.47µs        ? ?/sec    1.10    110.2±0.73µs        ? ?/sec
concat str 1024                                                1.00      6.0±0.01µs        ? ?/sec    1.04      6.3±0.02µs        ? ?/sec
concat str 8192 over 100 arrays                                1.00     48.6±0.24ms        ? ?/sec    1.07     52.2±0.23ms        ? ?/sec
concat str nulls 1024                                          1.00      3.2±0.01µs        ? ?/sec    1.01      3.2±0.00µs        ? ?/sec
concat str nulls 8192 over 100 arrays                          1.00     24.6±0.08ms        ? ?/sec    1.02     25.2±0.12ms        ? ?/sec
concat str_dict 1024                                           1.00      2.1±0.01µs        ? ?/sec    1.02      2.1±0.01µs        ? ?/sec
concat str_dict_sparse 1024                                    1.01      8.5±0.02µs        ? ?/sec    1.00      8.4±0.02µs        ? ?/sec
concat struct with int32 and dicts size=1024 count=2           1.02      5.0±0.02µs        ? ?/sec    1.00      4.9±0.02µs        ? ?/sec
concat utf8_view  max_str_len=128 null_density=0               1.00     58.4±0.03µs        ? ?/sec    1.00     58.4±0.08µs        ? ?/sec
concat utf8_view  max_str_len=128 null_density=0.2             1.00     59.0±0.04µs        ? ?/sec    1.02     60.2±0.78µs        ? ?/sec
concat utf8_view  max_str_len=20 null_density=0                1.00     58.7±0.05µs        ? ?/sec    1.00     58.4±0.48µs        ? ?/sec
concat utf8_view  max_str_len=20 null_density=0.2              1.00     59.1±0.10µs        ? ?/sec    1.00     59.4±0.12µs        ? ?/sec
concat utf8_view all_inline max_str_len=12 null_density=0      1.00     17.6±0.04µs        ? ?/sec    1.00     17.6±0.09µs        ? ?/sec
concat utf8_view all_inline max_str_len=12 null_density=0.2    1.01     18.1±0.53µs        ? ?/sec    1.00     18.0±0.31µs        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 235.1s
Peak memory 323.6 MiB
Avg memory 26.8 MiB
CPU user 217.1s
CPU sys 14.9s
Peak spill 0 B

branch

Metric Value
Wall time 245.1s
Peak memory 323.0 MiB
Avg memory 31.3 MiB
CPU user 218.7s
CPU sys 20.6s
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)

Comparing fix-dictionary-key-overflow-panic (5f53130) to 3abbc04 (merge-base) diff

Run configuration
run benchmark interleave_kernels
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                                                                                        fix-dictionary-key-overflow-panic      main
-----                                                                                        ---------------------------------      ----
interleave dict(20, 0.0) 100 [0..100, 100..230, 450..1000]                                   1.00    639.9±4.37ns        ? ?/sec    1.00    640.8±2.50ns        ? ?/sec
interleave dict(20, 0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]                         1.00   1854.4±8.06ns        ? ?/sec    1.00   1847.8±7.83ns        ? ?/sec
interleave dict(20, 0.0) 1024 [0..100, 100..230, 450..1000]                                  1.00   1819.5±5.11ns        ? ?/sec    1.00   1823.9±8.92ns        ? ?/sec
interleave dict(20, 0.0) 400 [0..100, 100..230, 450..1000]                                   1.00   1019.3±5.82ns        ? ?/sec    1.02   1035.3±1.86ns        ? ?/sec
interleave dict_distinct 100                                                                 1.00      2.1±0.01µs        ? ?/sec    1.00      2.1±0.01µs        ? ?/sec
interleave dict_distinct 1024                                                                1.00      2.1±0.01µs        ? ?/sec    1.01      2.2±0.01µs        ? ?/sec
interleave dict_distinct 2048                                                                1.01      2.2±0.01µs        ? ?/sec    1.00      2.1±0.01µs        ? ?/sec
interleave dict_sparse(20, 0.0) 100 [0..100, 100..230, 450..1000]                            1.01   1534.9±5.66ns        ? ?/sec    1.00   1526.2±3.63ns        ? ?/sec
interleave dict_sparse(20, 0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]                  1.00      3.0±0.01µs        ? ?/sec    1.01      3.0±0.01µs        ? ?/sec
interleave dict_sparse(20, 0.0) 1024 [0..100, 100..230, 450..1000]                           1.00      2.7±0.01µs        ? ?/sec    1.00      2.7±0.01µs        ? ?/sec
interleave dict_sparse(20, 0.0) 400 [0..100, 100..230, 450..1000]                            1.01   1940.0±5.96ns        ? ?/sec    1.00   1928.6±4.50ns        ? ?/sec
interleave fixed_size_list<i64,5>(0.0,0.0) 100 [0..100, 100..230, 450..1000]                 1.00    487.9±1.78ns        ? ?/sec    1.05    514.6±2.90ns        ? ?/sec
interleave fixed_size_list<i64,5>(0.0,0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]       1.00      3.0±0.00µs        ? ?/sec    1.01      3.0±0.01µs        ? ?/sec
interleave fixed_size_list<i64,5>(0.0,0.0) 1024 [0..100, 100..230, 450..1000]                1.00      3.0±0.01µs        ? ?/sec    1.01      3.0±0.00µs        ? ?/sec
interleave fixed_size_list<i64,5>(0.0,0.0) 400 [0..100, 100..230, 450..1000]                 1.00   1261.8±2.74ns        ? ?/sec    1.01   1271.4±4.52ns        ? ?/sec
interleave fixed_size_list<i64,5>(0.1,0.1) 100 [0..100, 100..230, 450..1000]                 1.00      2.3±0.02µs        ? ?/sec    1.00      2.3±0.02µs        ? ?/sec
interleave fixed_size_list<i64,5>(0.1,0.1) 1024 [0..100, 100..230, 450..1000, 0..1000]       1.00     19.1±0.27µs        ? ?/sec    1.01     19.2±0.26µs        ? ?/sec
interleave fixed_size_list<i64,5>(0.1,0.1) 1024 [0..100, 100..230, 450..1000]                1.00     19.0±0.26µs        ? ?/sec    1.01     19.2±0.26µs        ? ?/sec
interleave fixed_size_list<i64,5>(0.1,0.1) 400 [0..100, 100..230, 450..1000]                 1.00      7.7±0.11µs        ? ?/sec    1.01      7.8±0.10µs        ? ?/sec
interleave i32(0.0) 100 [0..100, 100..230, 450..1000]                                        1.00    213.1±2.01ns        ? ?/sec    1.00    214.0±2.22ns        ? ?/sec
interleave i32(0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]                              1.01    978.5±2.93ns        ? ?/sec    1.00    971.5±3.16ns        ? ?/sec
interleave i32(0.0) 1024 [0..100, 100..230, 450..1000]                                       1.00    957.6±2.47ns        ? ?/sec    1.07   1022.3±3.01ns        ? ?/sec
interleave i32(0.0) 400 [0..100, 100..230, 450..1000]                                        1.00    457.3±2.06ns        ? ?/sec    1.15    526.1±2.67ns        ? ?/sec
interleave i32(0.5) 100 [0..100, 100..230, 450..1000]                                        1.00    444.5±3.88ns        ? ?/sec    1.01    449.4±5.26ns        ? ?/sec
interleave i32(0.5) 1024 [0..100, 100..230, 450..1000, 0..1000]                              1.00      2.9±0.01µs        ? ?/sec    1.01      2.9±0.01µs        ? ?/sec
interleave i32(0.5) 1024 [0..100, 100..230, 450..1000]                                       1.00      3.0±0.02µs        ? ?/sec    1.01      3.0±0.03µs        ? ?/sec
interleave i32(0.5) 400 [0..100, 100..230, 450..1000]                                        1.00   1260.8±7.16ns        ? ?/sec    1.01  1275.2±10.45ns        ? ?/sec
interleave list<i64>(0.0,0.0,20) 100 [0..100, 100..230, 450..1000]                           1.00    853.1±1.34ns        ? ?/sec    1.00    853.1±1.24ns        ? ?/sec
interleave list<i64>(0.0,0.0,20) 1024 [0..100, 100..230, 450..1000, 0..1000]                 1.01      6.7±0.02µs        ? ?/sec    1.00      6.6±0.01µs        ? ?/sec
interleave list<i64>(0.0,0.0,20) 1024 [0..100, 100..230, 450..1000]                          1.00      6.6±0.01µs        ? ?/sec    1.00      6.6±0.05µs        ? ?/sec
interleave list<i64>(0.0,0.0,20) 400 [0..100, 100..230, 450..1000]                           1.01      2.8±0.01µs        ? ?/sec    1.00      2.7±0.00µs        ? ?/sec
interleave list<i64>(0.1,0.1,20) 100 [0..100, 100..230, 450..1000]                           1.00      2.5±0.01µs        ? ?/sec    1.03      2.5±0.01µs        ? ?/sec
interleave list<i64>(0.1,0.1,20) 1024 [0..100, 100..230, 450..1000, 0..1000]                 1.00     20.6±0.14µs        ? ?/sec    1.00     20.6±0.15µs        ? ?/sec
interleave list<i64>(0.1,0.1,20) 1024 [0..100, 100..230, 450..1000]                          1.00     20.7±0.12µs        ? ?/sec    1.00     20.8±0.14µs        ? ?/sec
interleave list<i64>(0.1,0.1,20) 400 [0..100, 100..230, 450..1000]                           1.00      8.3±0.05µs        ? ?/sec    1.00      8.3±0.04µs        ? ?/sec
interleave list_view<i64>(0.0,0.0,20) 100 [0..100, 100..230, 450..1000]                      1.00      2.3±0.01µs        ? ?/sec    1.00      2.3±0.01µs        ? ?/sec
interleave list_view<i64>(0.0,0.0,20) 1024 [0..100, 100..230, 450..1000, 0..1000]            1.01     14.5±0.07µs        ? ?/sec    1.00     14.4±0.04µs        ? ?/sec
interleave list_view<i64>(0.0,0.0,20) 1024 [0..100, 100..230, 450..1000]                     1.00     14.2±0.02µs        ? ?/sec    1.00     14.2±0.04µs        ? ?/sec
interleave list_view<i64>(0.0,0.0,20) 400 [0..100, 100..230, 450..1000]                      1.01      6.4±0.01µs        ? ?/sec    1.00      6.3±0.01µs        ? ?/sec
interleave list_view<i64>(0.1,0.1,20) 100 [0..100, 100..230, 450..1000]                      1.01      3.7±0.01µs        ? ?/sec    1.00      3.7±0.02µs        ? ?/sec
interleave list_view<i64>(0.1,0.1,20) 1024 [0..100, 100..230, 450..1000, 0..1000]            1.01     25.2±0.08µs        ? ?/sec    1.00     25.0±0.09µs        ? ?/sec
interleave list_view<i64>(0.1,0.1,20) 1024 [0..100, 100..230, 450..1000]                     1.01     25.2±0.08µs        ? ?/sec    1.00     25.1±0.10µs        ? ?/sec
interleave list_view<i64>(0.1,0.1,20) 400 [0..100, 100..230, 450..1000]                      1.01     10.9±0.05µs        ? ?/sec    1.00     10.8±0.03µs        ? ?/sec
interleave list_view_overlapping<i64>(80x,20) 100 [0..100, 100..230, 450..1000]              1.00      2.4±0.01µs        ? ?/sec    1.01      2.5±0.00µs        ? ?/sec
interleave list_view_overlapping<i64>(80x,20) 1024 [0..100, 100..230, 450..1000, 0..1000]    1.01      6.3±0.02µs        ? ?/sec    1.00      6.2±0.01µs        ? ?/sec
interleave list_view_overlapping<i64>(80x,20) 1024 [0..100, 100..230, 450..1000]             1.00      6.0±0.02µs        ? ?/sec    1.00      6.0±0.01µs        ? ?/sec
interleave list_view_overlapping<i64>(80x,20) 400 [0..100, 100..230, 450..1000]              1.00      3.0±0.01µs        ? ?/sec    1.02      3.1±0.01µs        ? ?/sec
interleave map<utf8,i64>(0.0,5,8) 100 [0..100, 100..230, 450..1000]                          1.00      2.5±0.00µs        ? ?/sec    1.01      2.5±0.00µs        ? ?/sec
interleave map<utf8,i64>(0.0,5,8) 1024 [0..100, 100..230, 450..1000, 0..1000]                1.00     18.9±0.04µs        ? ?/sec    1.01     19.0±0.06µs        ? ?/sec
interleave map<utf8,i64>(0.0,5,8) 1024 [0..100, 100..230, 450..1000]                         1.00     18.7±0.03µs        ? ?/sec    1.00     18.8±0.03µs        ? ?/sec
interleave map<utf8,i64>(0.0,5,8) 400 [0..100, 100..230, 450..1000]                          1.00      7.8±0.01µs        ? ?/sec    1.02      7.9±0.01µs        ? ?/sec
interleave map<utf8,i64>(0.1,5,8) 100 [0..100, 100..230, 450..1000]                          1.00      2.6±0.01µs        ? ?/sec    1.00      2.6±0.01µs        ? ?/sec
interleave map<utf8,i64>(0.1,5,8) 1024 [0..100, 100..230, 450..1000, 0..1000]                1.00     19.3±0.01µs        ? ?/sec    1.00     19.3±0.02µs        ? ?/sec
interleave map<utf8,i64>(0.1,5,8) 1024 [0..100, 100..230, 450..1000]                         1.00     18.9±0.04µs        ? ?/sec    1.00     18.9±0.04µs        ? ?/sec
interleave map<utf8,i64>(0.1,5,8) 400 [0..100, 100..230, 450..1000]                          1.00      7.9±0.02µs        ? ?/sec    1.00      7.9±0.02µs        ? ?/sec
interleave ree_i32<dict<u32,utf8>>(64 runs) 100 [0..100, 100..230, 450..1000]                1.00      4.2±0.01µs        ? ?/sec    1.02      4.3±0.01µs        ? ?/sec
interleave ree_i32<dict<u32,utf8>>(64 runs) 1024 [0..100, 100..230, 450..1000, 0..1000]      1.00     20.5±0.07µs        ? ?/sec    1.00     20.4±0.07µs        ? ?/sec
interleave ree_i32<dict<u32,utf8>>(64 runs) 1024 [0..100, 100..230, 450..1000]               1.00     20.2±0.07µs        ? ?/sec    1.00     20.2±0.08µs        ? ?/sec
interleave ree_i32<dict<u32,utf8>>(64 runs) 400 [0..100, 100..230, 450..1000]                1.00      9.5±0.03µs        ? ?/sec    1.00      9.5±0.02µs        ? ?/sec
interleave ree_i32<i64>(64 runs) 100 [0..100, 100..230, 450..1000]                           1.01      3.3±0.01µs        ? ?/sec    1.00      3.3±0.01µs        ? ?/sec
interleave ree_i32<i64>(64 runs) 1024 [0..100, 100..230, 450..1000, 0..1000]                 1.00     19.0±0.06µs        ? ?/sec    1.01     19.1±0.07µs        ? ?/sec
interleave ree_i32<i64>(64 runs) 1024 [0..100, 100..230, 450..1000]                          1.00     18.7±0.08µs        ? ?/sec    1.00     18.7±0.07µs        ? ?/sec
interleave ree_i32<i64>(64 runs) 400 [0..100, 100..230, 450..1000]                           1.00      8.2±0.03µs        ? ?/sec    1.03      8.5±0.02µs        ? ?/sec
interleave str(20, 0.0) 100 [0..100, 100..230, 450..1000]                                    1.00    602.8±1.10ns        ? ?/sec    1.01    609.3±1.91ns        ? ?/sec
interleave str(20, 0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]                          1.00      4.6±0.01µs        ? ?/sec    1.00      4.6±0.01µs        ? ?/sec
interleave str(20, 0.0) 1024 [0..100, 100..230, 450..1000]                                   1.00      4.6±0.01µs        ? ?/sec    1.00      4.6±0.01µs        ? ?/sec
interleave str(20, 0.0) 400 [0..100, 100..230, 450..1000]                                    1.00   1888.1±3.39ns        ? ?/sec    1.01   1901.5±8.10ns        ? ?/sec
interleave str(20, 0.5) 100 [0..100, 100..230, 450..1000]                                    1.00    743.6±1.18ns        ? ?/sec    1.03    764.3±5.42ns        ? ?/sec
interleave str(20, 0.5) 1024 [0..100, 100..230, 450..1000, 0..1000]                          1.00      6.0±0.02µs        ? ?/sec    1.00      6.0±0.02µs        ? ?/sec
interleave str(20, 0.5) 1024 [0..100, 100..230, 450..1000]                                   1.00      5.9±0.02µs        ? ?/sec    1.01      6.0±0.02µs        ? ?/sec
interleave str(20, 0.5) 400 [0..100, 100..230, 450..1000]                                    1.00      2.5±0.01µs        ? ?/sec    1.01      2.5±0.01µs        ? ?/sec
interleave str_view(0.0) 100 [0..100, 100..230, 450..1000]                                   1.00    578.0±9.03ns        ? ?/sec    1.01   581.5±15.62ns        ? ?/sec
interleave str_view(0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]                         1.00      2.6±0.01µs        ? ?/sec    1.01      2.6±0.03µs        ? ?/sec
interleave str_view(0.0) 1024 [0..100, 100..230, 450..1000]                                  1.00      2.6±0.01µs        ? ?/sec    1.00      2.5±0.01µs        ? ?/sec
interleave str_view(0.0) 400 [0..100, 100..230, 450..1000]                                   1.00  1210.5±10.59ns        ? ?/sec    1.03  1247.4±15.96ns        ? ?/sec
interleave struct(i32(0.0), i32(0.0) 100 [0..100, 100..230, 450..1000]                       1.01    640.8±3.83ns        ? ?/sec    1.00    635.1±6.50ns        ? ?/sec
interleave struct(i32(0.0), i32(0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]             1.00      2.2±0.00µs        ? ?/sec    1.00      2.2±0.01µs        ? ?/sec
interleave struct(i32(0.0), i32(0.0) 1024 [0..100, 100..230, 450..1000]                      1.00      2.2±0.00µs        ? ?/sec    1.01      2.2±0.01µs        ? ?/sec
interleave struct(i32(0.0), i32(0.0) 400 [0..100, 100..230, 450..1000]                       1.00   1147.7±3.44ns        ? ?/sec    1.00   1150.1±9.02ns        ? ?/sec
interleave struct(i32(0.0), str(20, 0.0) 100 [0..100, 100..230, 450..1000]                   1.00   1040.3±2.70ns        ? ?/sec    1.00   1035.5±4.48ns        ? ?/sec
interleave struct(i32(0.0), str(20, 0.0) 1024 [0..100, 100..230, 450..1000, 0..1000]         1.00      5.9±0.01µs        ? ?/sec    1.00      5.9±0.01µs        ? ?/sec
interleave struct(i32(0.0), str(20, 0.0) 1024 [0..100, 100..230, 450..1000]                  1.01      5.8±0.01µs        ? ?/sec    1.00      5.8±0.01µs        ? ?/sec
interleave struct(i32(0.0), str(20, 0.0) 400 [0..100, 100..230, 450..1000]                   1.01      2.6±0.01µs        ? ?/sec    1.00      2.6±0.01µs        ? ?/sec
interleave struct(str(20, 0.0), str(20, 0.0)) 100 [0..100, 100..230, 450..1000]              1.00   1412.5±3.53ns        ? ?/sec    1.00   1418.5±8.14ns        ? ?/sec
interleave struct(str(20, 0.0), str(20, 0.0)) 1024 [0..100, 100..230, 450..1000, 0..1000]    1.00      9.7±0.02µs        ? ?/sec    1.00      9.7±0.02µs        ? ?/sec
interleave struct(str(20, 0.0), str(20, 0.0)) 1024 [0..100, 100..230, 450..1000]             1.00      9.6±0.02µs        ? ?/sec    1.00      9.6±0.02µs        ? ?/sec
interleave struct(str(20, 0.0), str(20, 0.0)) 400 [0..100, 100..230, 450..1000]              1.01      4.1±0.01µs        ? ?/sec    1.00      4.1±0.01µs        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 845.2s
Peak memory 16.0 MiB
Avg memory 11.5 MiB
CPU user 839.6s
CPU sys 0.2s
Peak spill 0 B

branch

Metric Value
Wall time 840.2s
Peak memory 15.3 MiB
Avg memory 11.4 MiB
CPU user 836.9s
CPU sys 0.2s
Peak spill 0 B

File an issue against this benchmark runner

@okhsunrog

Copy link
Copy Markdown
Contributor Author

So, it can be merged now?

@Jefffrey
Jefffrey merged commit 365c760 into apache:main Aug 20, 2026
34 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @okhsunrog & @Rich-T-kid

emilk added a commit to emilk/arrow-rs that referenced this pull request Aug 20, 2026
`MutableArrayData::try_with_capacities` arrived with apache#10675. It only turns
the dictionary key overflow into an error, and still panics for the other
cases, so say so under a heading the lint recognises.

Co-Authored-By: Claude Opus 5 <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Aug 26, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Aug 28, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 2, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 18, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 21, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 25, 2026
…/concat (apache#10675)

# Which issue does this PR close?

- Closes apache#10674.

# Rationale for this change

`interleave()` and `concat()` document a `Result` return type, but for
`Dictionary<K, Utf8View>`/`Dictionary<K, BinaryView>` arrays (top-level
or nested inside a
`List`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`), a genuine
dictionary key overflow currently panics instead of returning `Err`.
This happens because the fallback path builds a `MutableArrayData`
directly and `.expect()`s the dictionary-concat result, and
`MutableArrayData::new`/`with_capacities` have no fallible variant. See
apache#10674 for the full analysis and a minimal repro.

# What changes are included in this PR?

- Add `MutableArrayData::try_new` / `try_with_capacities`, fallible
variants of `new` / `with_capacities` that return
`Err(ArrowError::DictionaryKeyOverflowError)` instead of panicking on
dictionary key overflow. `new()`/`with_capacities()` keep their existing
panicking behavior (now implemented as
`try_with_capacities(..).expect(..)`) for the many existing callers that
rely on infallibility.
- Recursive child construction inside `try_with_capacities` (for
`List`/`LargeList`/`Map`/`ListView`/`LargeListView`/`FixedSizeList`/`Struct`/`RunEndEncoded`/`Union`)
also uses the fallible variants and propagates errors with `?`, so
dictionaries nested inside container types are covered, not just
top-level dictionary arrays.
- Switch `arrow-select`'s `interleave_fallback` and `concat_fallback`
(the paths reached for dictionary arrays whose values can't/shouldn't be
merged) to the fallible constructors.

# Are these changes tested?

Yes:
- `concat_string_view_dictionary_overflow_returns_err` /
`test_interleave_string_view_dictionary_overflow_returns_err`: top-level
`Dictionary<UInt8, Utf8View>` overflow returns `Err` instead of
panicking.
- `concat_nested_dictionary_overflow_returns_err` /
`test_interleave_nested_dictionary_overflow_returns_err`: same overflow
nested inside a `FixedSizeList`, exercising the recursive child
construction.

Full `arrow-data`/`arrow-select` test suites pass (410 tests), `cargo
fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean
for both crates.

# Are there any user-facing changes?

No breaking changes. `MutableArrayData::new`/`with_capacities` keep
their documented panicking behavior and signatures. Two new public
fallible methods are added (`try_new`, `try_with_capacities`).
`interleave()`/`concat()` keep their existing `Result` signature -- the
only visible change is that a specific previously-panicking input
(genuine dictionary key overflow on `Utf8View`/`BinaryView`
dictionaries) now returns `Err(ArrowError::DictionaryKeyOverflowError)`
instead.

---------

Co-authored-by: Jeffrey Vo <[email protected]>
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 arrow-data arrow-select bug Squash those bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interleave/concat panic instead of erroring on genuine dictionary key overflow for Utf8View/BinaryView dictionaries

4 participants