You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
interleave panics with dictionary key overflows if combined values arrays are longer than key size #7466
interleave on dictionary arrays panics if the combined length of the input value arrays is larger than the max value allowed by the dictionary key type.
To Reproduce
Sample test:
#[test]fntest_interleave_dictionary_overflows(){// each array has length equal to the full dictionary key spacelet len:usize = usize::try_from(i8::MAX).unwrap();let a = DictionaryArray::<Int8Type>::new(Int8Array::from_value(0, len),Arc::new(Int8Array::from_value(0, len)),);let b = DictionaryArray::<Int8Type>::new(Int8Array::from_value(0, len),Arc::new(Int8Array::from_value(1, len)),);// Case 1: with a single input array, should _never_ overflowlet values = interleave(&[&a],&[(0,2),(0,2)]).unwrap();let v = values.as_dictionary::<Int8Type>();let vc = v.downcast_dict::<Int8Array>().unwrap();let collected:Vec<_> = vc.into_iter().map(Option::unwrap).collect();assert_eq!(&collected,&[0,0]);// Case 2: two arrays// Should still not overflow, there are only two valueslet values = interleave(&[&a,&b],&[(0,2),(0,2),(1,1)]).unwrap();let v = values.as_dictionary::<Int8Type>();let vc = v.downcast_dict::<Int8Array>().unwrap();let collected:Vec<_> = vc.into_iter().map(Option::unwrap).collect();assert_eq!(&collected,&[0,0,1]);}
Expected behavior
Tests should pass.
Additional context
It looks like there's solutions to avoid this on string dictionaries, but not other dictionary types.
It seems like the function merge_dictionary_values in arrow-select/src/dictionary.rs would need to be updated to support other array types. Probably just primitive arrays is good enough?
It might be simplest to just use PrimitiveDictionaryBuilder rather than make the Interner generic on the value type.
Activity
davidhewitt commentedon May 5, 2025
It seems like the function
merge_dictionary_valuesinarrow-select/src/dictionary.rswould need to be updated to support other array types. Probably just primitive arrays is good enough?It might be simplest to just use
PrimitiveDictionaryBuilderrather than make theInternergeneric on the value type.davidhewitt commentedon May 5, 2025
I suspect
concatalso has a similar problem.davidhewitt commentedon Aug 11, 2025
Fixed by #7519