cyberbeam524 opened a new pull request, #21714:
URL: https://github.com/apache/datafusion/pull/21714
## Which issue does this PR close?
- Closes #21626
## Rationale for this change
Ensures that DataFusion natively maps SQL UUID and JSON types to their
respective Arrow Canonical Extension Types. This standardizes how these types
are stored and metadata-tagged, allowing for seamless interoperability with
other Arrow-native tools.
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
- Updated planner.rs to map UUID to FixedSizeBinary(16) and JSON to Utf8
with official arrow.uuid and arrow.json metadata keys.
- Arrow Standards: Integrated arrow-schema extension constants
(EXTENSION_TYPE_NAME_KEY, Uuid::NAME, etc.) and included the required empty
string metadata for JSON types.
- Metadata Preservation in Statements: Refactored statement.rs to use
alias_with_metadata. This ensures that in CREATE TABLE ... AS SELECT (CTAS)
operations, the extension metadata survives the projection and is applied to
the new table schema.
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
Yes,
- Added sql_extension_types.slt which performs end-to-end testing of CAST
and CREATE TABLE for both UUID and JSON.
- Existing SQL logic tests pass, confirming no regressions in standard type
handling.
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
## Are there any user-facing changes?
Yes. UUID and JSON are now officially recognized SQL keywords in DataFusion
DDL and Casts, automatically resulting in Arrow-compliant canonical extension
types.
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]