diff --git a/vortex-array/src/builders/dict/bytes.rs b/vortex-array/src/builders/dict/bytes.rs index 361735536ed..88d45dc2601 100644 --- a/vortex-array/src/builders/dict/bytes.rs +++ b/vortex-array/src/builders/dict/bytes.rs @@ -71,7 +71,7 @@ impl BytesDictBuilder { values_nulls: BitBufferMut::empty(), hasher: DefaultHashBuilder::default(), dtype, - max_dict_bytes: constraints.max_bytes, + max_dict_bytes: constraints.max_bytes.min(u32::MAX as usize), max_dict_len: constraints.max_len, } } @@ -318,6 +318,7 @@ mod test { use vortex_error::VortexResult; use vortex_session::VortexSession; + use super::BytesDictBuilder; use crate::IntoArray; use crate::VortexSessionExecute; use crate::arrays::PrimitiveArray; @@ -430,4 +431,13 @@ mod test { assert_eq!(codes.as_slice::(), &[0, 0, 1, 1, 0, 1, 0, 1]); Ok(()) } + + #[test] + fn max_dict_bytes_cannot_exceed_the_view_offset_range() { + let builder = BytesDictBuilder::::new( + DType::Utf8(Nullability::NonNullable), + &super::super::UNCONSTRAINED, + ); + assert_eq!(builder.max_dict_bytes, u32::MAX as usize); + } }