Skip to content

Commit e21dc1b

Browse files
Show example where we check for UUid extension type
1 parent 3567f6c commit e21dc1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

parquet-variant-compute/src/variant_array.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ fn typed_value_to_variant<'a>(
972972
value: Option<&BinaryViewArray>,
973973
index: usize,
974974
) -> Variant<'a, 'a> {
975-
let (_, typed_value_column) = typed_value;
975+
let (typed_value_field, typed_value_column) = typed_value;
976976

977977
let data_type = typed_value_column.data_type();
978978
if value.is_some_and(|v| !matches!(data_type, DataType::Struct(_)) && v.is_valid(index)) {
@@ -992,7 +992,11 @@ fn typed_value_to_variant<'a>(
992992
Variant::from(date)
993993
}
994994
// 16-byte FixedSizeBinary alway corresponds to a UUID; all other sizes are illegal.
995-
DataType::FixedSizeBinary(16) => {
995+
DataType::FixedSizeBinary(16)
996+
if typed_value_field
997+
.try_extension_type::<arrow_schema::extension::Uuid>()
998+
.is_ok() =>
999+
{
9961000
let array = typed_value_column.as_fixed_size_binary();
9971001
let value = array.value(index);
9981002
Uuid::from_slice(value).unwrap().into() // unwrap is safe: slice is always 16 bytes

0 commit comments

Comments
 (0)