Skip to content

Commit 87aa18b

Browse files
authored
Feature: Add DType::FixedSizeList variant (#4371)
Adds the variant `DType::FixedSizeList`, but without most of the implementations. The `unimplemented!`s and `TODO(connor)[FixedSizeList]` will be fixed in later PRs. Also fixes a bug and incorrect tests with `list_empty` in `vortex-scalar`, where creating an empty list made a null scalar. Finally, adds some more casting tests in `vortex-scalar` (which found a bug in `vortex-scalar/src/scalar.rs` where the logic did not work for nested scalars). (Tracking Issue incoming soon) Signed-off-by: Connor Tsui <[email protected]>
1 parent 16cae30 commit 87aa18b

File tree

36 files changed

+418
-106
lines changed

36 files changed

+418
-106
lines changed

encodings/sparse/src/canonical.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ impl CanonicalVTable<SparseVTable> for SparseVTable {
8888
*nullability,
8989
)
9090
}
91+
DType::FixedSizeList(..) => {
92+
unimplemented!("TODO(connor)[FixedSizeList]")
93+
}
9194
DType::Extension(_ext_dtype) => todo!(),
9295
}
9396
}

fuzz/src/array/compare.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ pub fn compare_canonical_array(
116116
)
117117
.into_array())
118118
}
119+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
119120
d @ (DType::Null | DType::Extension(_)) => {
120121
unreachable!("DType {d} not supported for fuzzing")
121122
}

fuzz/src/array/filter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ pub fn filter_canonical_array(array: &dyn Array, filter: &[bool]) -> VortexResul
108108
}
109109
take_canonical_array_non_nullable_indices(array, indices.as_slice())
110110
}
111+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
111112
d @ (DType::Null | DType::Extension(_)) => {
112113
unreachable!("DType {d} not supported for fuzzing")
113114
}

fuzz/src/array/search_sorted.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub fn search_sorted_canonical_array(
124124
let scalar_vals = (0..array.len()).map(|i| array.scalar_at(i)).collect_vec();
125125
Ok(scalar_vals.search_sorted(&scalar.cast(array.dtype())?, side))
126126
}
127+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
127128
d @ (DType::Null | DType::Extension(_)) => {
128129
unreachable!("DType {d} not supported for fuzzing")
129130
}

fuzz/src/array/slice.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub fn slice_canonical_array(
8686
.into_array();
8787
ListArray::try_new(elements, offsets, validity).map(|a| a.into_array())
8888
}
89+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
8990
DType::Decimal(decimal_dtype, _) => {
9091
let decimal_array = array.to_decimal()?;
9192
Ok(

fuzz/src/array/sort.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub fn sort_canonical_array(array: &dyn Array) -> VortexResult<ArrayRef> {
8181
});
8282
take_canonical_array_non_nullable_indices(array, &sort_indices)
8383
}
84+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
8485
d @ (DType::Null | DType::Extension(_)) => {
8586
unreachable!("DType {d} not supported for fuzzing")
8687
}

fuzz/src/array/take.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub fn take_canonical_array(
124124
}
125125
Ok(builder.finish())
126126
}
127+
DType::FixedSizeList(..) => unimplemented!("TODO(connor)[FixedSizeList]"),
127128
d @ (DType::Null | DType::Extension(_)) => {
128129
unreachable!("DType {d} not supported for fuzzing")
129130
}

vortex-array/src/arrays/arbitrary.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ fn random_array(u: &mut Unstructured, dtype: &DType, len: Option<usize>) -> Resu
124124
.into_array())
125125
}
126126
DType::List(ldt, n) => random_list(u, ldt, *n, chunk_len),
127+
DType::FixedSizeList(..) => {
128+
unimplemented!("TODO(connor)[FixedSizeList]")
129+
}
127130
DType::Extension(..) => {
128131
todo!("Extension arrays are not implemented")
129132
}

vortex-array/src/arrays/constant/canonical.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ impl CanonicalVTable<ConstantVTable> for ConstantVTable {
128128
array.len(),
129129
)?)
130130
}
131+
DType::FixedSizeList(..) => {
132+
unimplemented!("TODO(connor)[FixedSizeList]")
133+
}
131134
DType::Extension(ext_dtype) => {
132135
let s = ExtScalar::try_from(scalar)?;
133136

vortex-array/src/builders/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ mod tests {
276276
}
277277

278278
#[test]
279-
fn test_non_null_fails() {
279+
fn test_append_empty_list() {
280280
let dtype: Arc<DType> = Arc::new(I32.into());
281281
let mut builder = ListBuilder::<u32>::with_capacity(dtype.clone(), NonNullable, 0);
282282

283283
assert!(
284284
builder
285285
.append_value(Scalar::list_empty(dtype, NonNullable).as_list())
286-
.is_err()
286+
.is_ok()
287287
)
288288
}
289289

0 commit comments

Comments
 (0)