Skip to content

Support SQL casts from stored and composed Variant values - #107

Merged
sdf-jkl merged 1 commit into
datafusion-contrib:mainfrom
sdf-jkl:codex/cast-from-variant
Oct 27, 2026
Merged

sdf-jkl merged 1 commit into
datafusion-contrib:mainfrom
sdf-jkl:codex/cast-from-variant

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Support CAST(v AS type) and TRY_CAST(v AS type) for stored and composed Variant values, extending the existing getter cast rewrite to use root extraction. Preserve explicit intermediate conversions and dispatch using Variant extension metadata, while reusing the existing getter and Arrow kernels.

Add SQL coverage for materialized results and schemas, strict/try behavior, composed expressions, Binary/LargeBinary storage, shredded inputs, and ordinary struct casts. Extend the registration-order test and document the new syntax. A skipped assertion records an existing Arrow limitation: casting shredded Variant null to a struct yields a valid struct of null fields instead of SQL NULL.

Validation: cargo test --offline (unit, SQL, README, and doc tests), cargo fmt --all -- --check, cargo clippy --offline -- -D warnings, and git diff --check passed. Benchmarks were not run.

Closes #90. Related to #71.

@sdf-jkl
sdf-jkl merged commit 421c982 into datafusion-contrib:main Oct 27, 2026
3 checks passed
@sdf-jkl
sdf-jkl deleted the codex/cast-from-variant branch October 27, 2026 20:56
@alamb

alamb commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

This is good. One thing I noticed is that the type planner isn't registered as part of register_all

@alamb

alamb commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support general SQL casts from VARIANT

2 participants