[Variant] Support UUID conversion in cast_to_variant

オープン
#11,937 コメント 6 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
data

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
3.7k
フォーク
1.5k
平均マージ
2日 16時間
マージ済み PR(30日)
183

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/arrow-rs のほかの issue

apache/arrow-rs の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。