[Variant] Support UUID conversion in cast_to_variant

Aperta
#11,937 6 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
data

Direzione di ricerca

Read parquet-variant-compute/src/cast_to_variant.rs and src/arrow_to_variant.rs, especially the fixed-size binary conversion path. Trace how the conversion receives arrays and how nested list, struct, and map fields are handled; the issue leaves the API shape open. Done means field metadata can preserve annotated UUID values, unannotated binary remains binary, nulls remain null, and existing array-only callers keep their behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Is your feature request related to a problem or challenge?

This came up while implementing SQL casts to Variant in datafusion-variant.

cast_to_variant and cast_to_variant_with_options cannot distinguish an Arrow UUID column from ordinary FixedSizeBinary(16). The arrow.uuid annotation belongs to the input Field, but these APIs accept only &dyn Array.

The conversion dispatches on the storage data type and converts fixed-size binary values to Variant::Binary. A caller implementing CAST(uuid_column AS VARIANT) therefore cannot preserve UUID semantics through this kernel, even when it has the correctly annotated input field.

This follows from the implementation in Arrow 60.0.0 and remains the case on current main: the fixed-size binary path receives no extension metadata.

Describe the solution you'd like

Allow callers to supply input field information, for example through a conversion entry point accepting &Field and &dyn Array. Use the canonical arrow.uuid annotation to distinguish UUID from ordinary binary:

Input Expected Variant value
FixedSizeBinary(16) annotated with arrow.uuid Variant::Uuid
Unannotated FixedSizeBinary(16) Variant::Binary
Arrow null Arrow null

Honor UUID annotations on nested fields in lists, structs, and maps as well. Existing array-only callers should retain their binary conversion behavior. The exact API shape is open for discussion.

Additional context

Related work addressed UUID metadata in shredded Variant storage:

  • #10015: merged UUID metadata preservation for shredded fields and Parquet writing.

In #10015's discussion, the justification was that a shredded FixedSizeBinary(16) field can only represent UUID: Arrow uses dedicated decimal types, and the shredding specification stores binary as BYTE_ARRAY. The merged change therefore attaches UUID metadata when constructing or canonicalizing those shredded fields.

That inference relies on the input already being shredded Variant storage. Ordinary Arrow inputs to cast_to_variant need their field metadata to distinguish UUID from binary.

Lingua principale
Rust
Stelle
3.7k
Fork
1.5k
Merge medio
2g 16h
PR unite (30g)
183

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/arrow-rs

Tutte le issue di apache/arrow-rs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.