Skip to content

[Variant] Overly aggressive inference of UUID values #8420

@scovich

Description

@scovich

Describe the bug

When converting strongly-typed arrow arrays to binary variant, typed_value_to_variant has the following code, which unconditionally treats all 16-byte values as UUID:

        DataType::FixedSizeBinary(binary_len) => {
            let array = typed_value.as_fixed_size_binary();
            // Try to treat 16 byte FixedSizeBinary as UUID
            let value = array.value(index);
            if *binary_len == 16 {
                if let Ok(uuid) = Uuid::from_slice(value) {
                    return Variant::from(uuid);
                }
            }   
            let value = array.value(index);
            Variant::from(value)
        }

To Reproduce

Create a FixedSizeBinaryArray with length 16 and convert to variant.

Expected behavior

UUIDs should only be produced if the UUID extension type is present.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions