Skip to content

Commit 4d92593

Browse files
committed
Add DType::Union variant carrying just Nullability
This is the first of two commits splitting the original Union work. It adds the `Union(Nullability)` enum variant, plumbs it through all existing match arms with `todo!("TODO(connor)[Union]: unimplemented")`, and reserves slot 12 in the flatbuffer and protobuf wire schemas. A follow-up commit will replace `Union(Nullability)` with `Union(UnionVariants, Nullability)` and fill in the serde paths. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 55d296e commit 4d92593

45 files changed

Lines changed: 360 additions & 28 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

encodings/sparse/src/canonical.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ pub(super) fn execute_sparse(parts: SparseParts, ctx: &mut ExecutionCtx) -> Vort
122122
len,
123123
ctx,
124124
)?,
125+
DType::Union(..) => todo!("TODO(connor)[Union]: unimplemented"),
125126
DType::Decimal(decimal_dtype, nullability) => {
126127
let canonical_decimal_value_type =
127128
DecimalType::smallest_decimal_value_type(decimal_dtype);

fuzz/src/array/compare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub fn compare_canonical_array(
173173
}))
174174
.into_array()
175175
}
176-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
176+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
177177
unreachable!("DType {d} not supported for fuzzing")
178178
}
179179
}

fuzz/src/array/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn filter_canonical_array(
122122
}
123123
take_canonical_array_non_nullable_indices(array, indices.as_slice(), ctx)
124124
}
125-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
125+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
126126
unreachable!("DType {d} not supported for fuzzing")
127127
}
128128
}

fuzz/src/array/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ fn actions_for_dtype(dtype: &DType) -> HashSet<ActionType> {
474474
acc.intersection(&actions).copied().collect()
475475
})
476476
}
477+
DType::Union(..) => todo!("TODO(connor)[Union]: unimplemented"),
477478
DType::List(..) | DType::FixedSizeList(..) => {
478479
// List supports: Compress, Slice, Take, Filter, MinMax, Mask, ScalarAt
479480
// Does NOT support: SearchSorted, Compare, Cast, Sum, FillNull

fuzz/src/array/search_sorted.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn search_sorted_canonical_array(
148148
.collect::<VortexResult<Vec<_>>>()?;
149149
scalar_vals.search_sorted(&scalar.cast(array.dtype())?, side)
150150
}
151-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
151+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
152152
unreachable!("DType {d} not supported for fuzzing")
153153
}
154154
}

fuzz/src/array/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub fn slice_canonical_array(
123123
.into_array(),
124124
)
125125
}
126-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
126+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
127127
unreachable!("DType {d} not supported for fuzzing")
128128
}
129129
}

fuzz/src/array/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub fn sort_canonical_array(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexR
101101
});
102102
take_canonical_array_non_nullable_indices(array, &sort_indices, ctx)
103103
}
104-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
104+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
105105
unreachable!("DType {d} not supported for fuzzing")
106106
}
107107
}

fuzz/src/array/take.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn take_canonical_array(
147147
}
148148
Ok(builder.finish())
149149
}
150-
d @ (DType::Null | DType::Extension(_) | DType::Variant(_)) => {
150+
d @ (DType::Null | DType::Union(..) | DType::Extension(_) | DType::Variant(_)) => {
151151
unreachable!("DType {d} not supported for fuzzing")
152152
}
153153
}

vortex-array/public-api.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9346,6 +9346,8 @@ pub vortex_array::dtype::DType::Primitive(vortex_array::dtype::PType, vortex_arr
93469346

93479347
pub vortex_array::dtype::DType::Struct(vortex_array::dtype::StructFields, vortex_array::dtype::Nullability)
93489348

9349+
pub vortex_array::dtype::DType::Union(vortex_array::dtype::Nullability)
9350+
93499351
pub vortex_array::dtype::DType::Utf8(vortex_array::dtype::Nullability)
93509352

93519353
pub vortex_array::dtype::DType::Variant(vortex_array::dtype::Nullability)
@@ -9422,6 +9424,8 @@ pub fn vortex_array::dtype::DType::is_signed_int(&self) -> bool
94229424

94239425
pub fn vortex_array::dtype::DType::is_struct(&self) -> bool
94249426

9427+
pub fn vortex_array::dtype::DType::is_union(&self) -> bool
9428+
94259429
pub fn vortex_array::dtype::DType::is_unsigned_int(&self) -> bool
94269430

94279431
pub fn vortex_array::dtype::DType::is_utf8(&self) -> bool

vortex-array/src/aggregate_fn/fns/uncompressed_size_in_bytes/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ pub(crate) fn constant_uncompressed_size_in_bytes(
247247
let canonical = array.array().clone().execute::<Canonical>(ctx)?;
248248
return canonical_uncompressed_size_in_bytes(&canonical, ctx);
249249
}
250+
DType::Union(..) => todo!("TODO(connor)[Union]: unimplemented"),
250251
};
251252

252253
value_size
@@ -293,6 +294,7 @@ fn supports_uncompressed_size_in_bytes(dtype: &DType) -> bool {
293294
DType::Struct(fields, _) => fields
294295
.fields()
295296
.all(|field| supports_uncompressed_size_in_bytes(&field)),
297+
DType::Union(_) => todo!("TODO(connor)[Union]: unimplemented"),
296298
DType::Extension(ext_dtype) => {
297299
supports_uncompressed_size_in_bytes(ext_dtype.storage_dtype())
298300
}

0 commit comments

Comments
 (0)