Skip to content

[branch-56] feat: show extension type names in DESCRIBE and information_schema.columns (backport #26893) - #27057

Draft
alamb wants to merge 1 commit into
apache:branch-56from
alamb:alamb/backport-26893-branch-56
Draft

alamb wants to merge 1 commit into
apache:branch-56from
alamb:alamb/backport-26893-branch-56

Conversation

@alamb

@alamb alamb commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

…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)
@alamb alamb mentioned this pull request Nov 3, 2026
20 of 42 tasks
@github-actions github-actions Bot added logical-expr Logical plan and expressions core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) catalog Related to the catalog crate common Related to common crate labels Nov 3, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.93878% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.26%. Comparing base (1635ed9) to head (d63dfc8).

Files with missing lines Patch % Lines
datafusion/common/src/types/extension.rs 0.00% 3 Missing ⚠️
Flag Coverage Δ
all-tests 83.26% <96.93%> (+<0.01%) ⬆️
sqllogictests 60.73% <95.45%> (+0.03%) ⬆️

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            
Files with missing lines Coverage Δ
datafusion/catalog/src/information_schema.rs 90.85% <100.00%> (+0.12%) ⬆️
...sion/common/src/types/canonical_extensions/json.rs 56.25% <100.00%> (+56.25%) ⬆️
...sion/common/src/types/canonical_extensions/uuid.rs 75.92% <100.00%> (+3.37%) ⬆️
datafusion/core/src/execution/session_state.rs 79.26% <100.00%> (+0.03%) ⬆️
datafusion/core/src/physical_planner.rs 82.63% <100.00%> (+<0.01%) ⬆️
...fusion/expr/src/logical_plan/information_schema.rs 96.76% <100.00%> (+0.39%) ⬆️
datafusion/sqllogictest/src/test_context.rs 94.64% <100.00%> (+0.04%) ⬆️
datafusion/common/src/types/extension.rs 0.00% <0.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

catalog Related to the catalog crate common Related to common crate core Core DataFusion crate logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants