Skip to content

Allow SQL TypePlanner to plan SQL types as extension types#20676

Open
paleolimbot wants to merge 4 commits intoapache:mainfrom
paleolimbot:sql-type-planner-ext
Open

Allow SQL TypePlanner to plan SQL types as extension types#20676
paleolimbot wants to merge 4 commits intoapache:mainfrom
paleolimbot:sql-type-planner-ext

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Mar 3, 2026

Which issue does this PR close?

Rationale for this change

The existing enum SQLDataType has a number of existing members that have canonical Arrow extension type equivalents; however, the TypePlanner trait only supports returning DataType (which cannot represent an Arrow extension type).

This will be substantially more useful after #18136, as the SQL planner inserts casts in a number of places (and currently the extension metadata of those casts is dropped when the logical cast is created).

What changes are included in this PR?

This PR adds a fn plan_type_field() member to the TypePlanner trait. The only place that the previously existing plan_type() member was called was already wrapping it in a FieldRef and so few other changes were needed.

Are these changes tested?

Yes

Are there any user-facing changes?

Existing TypePlanners will continue to work and an example was added for supporting the UUID type.

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions labels Mar 3, 2026
@paleolimbot paleolimbot force-pushed the sql-type-planner-ext branch from e00cd32 to e0c56f2 Compare March 3, 2026 17:22
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 3, 2026
@paleolimbot paleolimbot marked this pull request as ready for review March 3, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation logical-expr Logical plan and expressions sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow SQL TypePlanner to plan SQL types as extension types

1 participant