Skip to content

cast_to_variant: Support casting from more column types #3

@friendlymatthew

Description

@friendlymatthew

Currently, cast_to_variant accepts the following arguments:

cast_to_variant(BinaryViewArray, BinaryViewArray) # represents metadata, value columns

I don't see why we can support the following:

cast_to_variant(StringArray | StringViewArray | LargeStringArray) # represents String values

where each str (s) in the array can be converted to a Variant from Variant::from(s)

This applies to other array types like FixedSizeBinaryArray

cast_to_variant(FixedSizeBinaryArray) # represents UUID (FixedSizeBinary(16))

match args.arg_fields.as_slice() {
[metadata_field, variant_field] => {
try_field_as_binary(metadata_field.as_ref())?;
try_field_as_binary(variant_field.as_ref())?;
}
_ => {
// right now, let's only support (BinaryViewArray, BinaryViewArray)
// but I don't see why we couldn't call cast_to_variant(string_column) -> VariantArray...
return exec_err!("unsupported, expected 2 arguments");
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions