Skip to content

[Variant] Implement cast_to_variant kernel #8043

Closed

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
As @Samyak2 noted on https://github.com/apache/arrow-rs/pull/8021/files#r2249926579, having the ability to convert FROM a typed value to a VariantArray will be important

For example, in SQL it could be used to cast columns to variant like in some_column::variant

Describe the solution you'd like

I would like a kernel like this:

/// Casts a typed arrow [`Array`] to a [`VariantArray`]. This is useful when you
/// need to convert a specific data type
pub fn cast_to_variant(input: &dyn Array) -> Result<VariantArray, ArrowError> {

Describe alternatives you've considered

I started down a templated route (see below) that got somewhat complicated

Additional context

Activity

  1. added
    enhancement
    on Aug 5, 2025
  2. self-assigned this
    on Aug 5, 2025
  3. added
    parquet
    on Aug 21, 2025
  4. alamb commented on Aug 21, 2025

    @alamb
    ContributorAuthor

    label_issue.py automatically added labels {'parquet'} from #8044

  5. removed
    enhancement
    on Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

parquet

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions