diff --git a/vortex-array/src/array/list/mod.rs b/vortex-array/src/array/list/mod.rs index cbea5d15f..d73dfde38 100644 --- a/vortex-array/src/array/list/mod.rs +++ b/vortex-array/src/array/list/mod.rs @@ -8,17 +8,14 @@ use serde::{Deserialize, Serialize}; use vortex_dtype::{match_each_native_ptype, DType, PType}; use vortex_error::{vortex_bail, vortex_panic, VortexExpect, VortexResult}; -use crate::array::{NullArray, PrimitiveArray}; +use crate::array::PrimitiveArray; use crate::compute::{scalar_at, slice}; use crate::encoding::ids; use crate::stats::{Stat, StatisticsVTable, StatsSet}; use crate::validity::{LogicalValidity, Validity, ValidityMetadata, ValidityVTable}; use crate::variants::{ListArrayTrait, PrimitiveArrayTrait, VariantsVTable}; use crate::visitor::{ArrayVisitor, VisitorVTable}; -use crate::{ - impl_encoding, ArrayDType, ArrayData, ArrayLen, ArrayTrait, Canonical, IntoArrayData, - IntoCanonical, -}; +use crate::{impl_encoding, ArrayDType, ArrayData, ArrayLen, ArrayTrait, Canonical, IntoCanonical}; impl_encoding!("vortex.list", ids::LIST, List); @@ -122,12 +119,6 @@ impl ListArray { // TODO: fetches the elements at index pub fn elements_at(&self, index: usize) -> VortexResult { - if index >= self.len() { - vortex_bail!("Index out of bounds: index={} len={}", index, self.len()); - } - if !self.is_valid(index) { - return Ok(NullArray::new(1).into_array()); - } let start = self.offset_at(index); let end = self.offset_at(index + 1); slice(self.elements(), start, end) diff --git a/vortex-array/src/builders/list.rs b/vortex-array/src/builders/list.rs index bbf350575..2fbf73e2e 100644 --- a/vortex-array/src/builders/list.rs +++ b/vortex-array/src/builders/list.rs @@ -233,8 +233,7 @@ mod tests { let list_array = list.into_list().unwrap(); assert_eq!(list_array.elements_at(0).unwrap().len(), 3); - assert!(list_array.elements_at(1).unwrap().as_null_array().is_some()); - assert_eq!(list_array.elements_at(1).unwrap().len(), 1); + assert_eq!(list_array.elements_at(1).unwrap().len(), 0); assert_eq!(list_array.elements_at(2).unwrap().len(), 3); } }