Repository navigation
Conversation
…lumns (apache#26893) ## Which issue does this PR close? - Closes apache#26866. ## Rationale for this change `DESCRIBE`, `SHOW COLUMNS` and `information_schema.columns` show the storage type of a column, even if the column has a registered extension type. For example, a UUID column is shown as `FixedSizeBinary(16)`. Extension types can already customize how their values are formatted, but not how their type is named. With the canonical extension types registered, `DESCRIBE` of a table with a UUID column `u` and a plain column `i` now shows: ``` u UUID YES i Int32 NO ``` Before, the first row was `u FixedSizeBinary(16) YES`. ## What changes are included in this PR? - New method `DFExtensionType::display_name(&self) -> Option<Cow<'_, str>>`. The default returns `None`, which means that the storage type is shown, as before. A name can be static, borrowed from the type or computed from its metadata, so parameterized names are possible. - New function `datafusion_expr::extension_types::append_field_type_display_name(registry, field, builder)`. It appends the display name of the registered extension type of the field to a `StringBuilder`, or else the storage type. It also appends the storage type if the extension type is not registered or cannot be created from the field metadata, so that `DESCRIBE` does not fail on such a column. - `InformationSchemaColumnsBuilder`, which `DESCRIBE`, `SHOW COLUMNS` and `information_schema.columns` share, uses this function with the registry from `with_extension_type_registry`. - `InformationSchemaProvider::with_extension_type_registry` passes the session registry to that builder. The physical planner and `SessionState` set it where they create the provider. - `DFUuid` returns `UUID` and `DFJson` returns `JSON`. The other canonical extension types keep showing their storage type. I was not sure which names to use for them (for example for tensors, whose names would depend on the metadata) and am happy to add them here or in a follow-up. The canonical extension types are not registered in a default session, so the default output does not change. ## What is the testing strategy for this PR? - `extension_type_names.slt` registers the canonical extension types and a table with columns of registered types with and without a display name, of an unregistered extension type and of a plain type. It checks `DESCRIBE`, `information_schema.columns`, `SHOW COLUMNS` and a view. - A unit test for `append_field_type_display_name`, including the fallbacks. ## Are there any user-facing changes? Yes, sessions that register extension types with a display name, such as the canonical `arrow.uuid` and `arrow.json`, show that name in `DESCRIBE`, `SHOW COLUMNS` and `information_schema.columns`. There are no breaking API changes: the new trait method has a default implementation. --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 608ac9c)
20 of 42 tasks
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## branch-56 #27057 +/- ##
===========================================
Coverage 83.25% 83.26%
===========================================
Files 1169 1169
Lines 474294 474386 +92
Branches 474294 474386 +92
===========================================
+ Hits 394887 395002 +115
+ Misses 55485 55462 -23
Partials 23922 23922
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
56.0.0(Oct/Nov 2026) #24461branch-56