You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2026/03/03 16:35:19 UTC
[PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
paleolimbot opened a new pull request, #20676:
URL: https://github.com/apache/datafusion/pull/20676
## Which issue does this PR close?
- Closes #20675
## 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).
## 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?
No, existing `TypePlanner`s will continue to work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #20676:
URL: https://github.com/apache/datafusion/pull/20676
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #20676:
URL: https://github.com/apache/datafusion/pull/20676#discussion_r2884001897
##########
datafusion/expr/src/planner.rs:
##########
@@ -440,4 +440,17 @@ pub trait TypePlanner: Debug + Send + Sync {
) -> Result<Option<DataType>> {
Ok(None)
}
+
+ /// Plan SQL [`sqlparser::ast::DataType`] to DataFusion [`FieldRef`]
+ ///
+ /// Returns None if not possible. The default implementation falls back
+ /// on plan_type and wraps it in a nullable field reference.
+ fn plan_type_field(
Review Comment:
Maybe we can help document how this is different from plan_type (or should we be deprecating plan_type in favor of `plan_type_field`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #20676:
URL: https://github.com/apache/datafusion/pull/20676#issuecomment-4026810125
Thanks @paleolimbot
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #20676:
URL: https://github.com/apache/datafusion/pull/20676#issuecomment-4000274731
I added the deprecation here and a note on the reason for using the new member. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Allow SQL `TypePlanner` to plan SQL types as extension types [datafusion]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #20676:
URL: https://github.com/apache/datafusion/pull/20676#discussion_r2879351669
##########
datafusion/sql/tests/sql_integration.rs:
##########
@@ -4727,6 +4727,14 @@ fn test_custom_type_plan() -> Result<()> {
"#
);
+ let plan = plan_sql("SELECT UUID '00010203-0405-0607-0809-000102030506'");
+ assert_snapshot!(
+ plan,
+ @r#"
+ Projection: CAST(Utf8("00010203-0405-0607-0809-000102030506") AS FixedSizeBinary(16))
+ EmptyRelation: rows=1
+ "#
+ );
Review Comment:
When https://github.com/apache/datafusion/pull/18136 merges we can update this to reflect the printing of logical casts where the target contains metadata like the metadata we've added here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org