Skip to content

Commit 7cd3f2f

Browse files
branczclaude
andcommitted
test: round-trip fixed-size list scalars through protobuf
Covers the ConstantArray metadata path for fixed-size list dtypes (e.g. a UUID column stored as fixed_size_list(u8)[16]): serialization writes the scalar as a protobuf ListValue, and deserialization previously rejected it with "expected List dtype for ListValue". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
1 parent 907e83a commit 7cd3f2f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

vortex-array/src/scalar/tests/round_trip.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,25 @@ mod tests {
254254
assert_eq!(extracted.as_slice(), &large_binary);
255255
}
256256

257+
// Test that fixed-size list scalars round-trip through protobuf. This is
258+
// the path taken by a ConstantArray of a fixed-size list dtype (e.g. a
259+
// UUID column stored as fixed_size_list(u8)[16]), whose scalar metadata
260+
// is serialized as a protobuf ListValue.
261+
#[test]
262+
fn test_protobuf_fixed_size_list_round_trip() {
263+
let fsl = Scalar::fixed_size_list(
264+
Arc::new(DType::Primitive(PType::U8, Nullability::NonNullable)),
265+
(0u8..16)
266+
.map(|i| Scalar::primitive(i, Nullability::NonNullable))
267+
.collect(),
268+
Nullability::NonNullable,
269+
);
270+
271+
let pb_fsl = pb::Scalar::from(&fsl);
272+
let round_tripped = Scalar::from_proto(&pb_fsl, &SESSION).unwrap();
273+
assert_eq!(fsl, round_tripped);
274+
}
275+
257276
// Test that nullable and non-nullable types are preserved
258277
#[test]
259278
fn test_nullability_preservation() {

0 commit comments

Comments
 (0)