Skip to content

Cherry-pick apache/datafusion#25015 onto branch-55 - #179

Merged
moraistejerina merged 1 commit into
branch-55from
jorge.morais/cherry-pick/apache-pr-25015-branch-55-20260908
Sep 8, 2026
Merged

moraistejerina merged 1 commit into
branch-55from
jorge.morais/cherry-pick/apache-pr-25015-branch-55-20260908

Conversation

@moraistejerina

@moraistejerina moraistejerina commented Sep 8, 2026 •

Copy link
Copy Markdown

cherry-picks apache#25015 (merged as d682553) onto branch-55.

Same change as #178 (merged into branch-54 as b41aefa), requested by query-execution so it survives the 54->55 upgrade. Adds SubstraitConsumer::consume_type_metadata(&Type), an extension point letting a consumer attach Arrow field metadata to a Substrait type Arrow can't natively represent, applied via a single attach point (substrait_type_to_field) so nested types (list/map/struct) keep metadata too.

…r-defined types (apache#25015)

## Which issue does this PR close?

N/A

## Rationale for this change

`consume_user_defined_type` maps a Substrait user-defined type straight
to a bare `DataType`, so a consumer has no way to mark the resulting
`Field` for a downstream reader to recover semantic type lost in that
mapping. For example, a UDT representing JSON is commonly mapped to
plain `Utf8`, which is then indistinguishable from a real string column
once it reaches a consumer that only sees the Arrow schema (e.g. over
Arrow Flight, with no access to the original plan).

## What changes are included in this PR?

- Adds `consume_user_defined_type_metadata`, a second, additive
extension point on `SubstraitConsumer` defaulting to `Ok(None)`.
- Applies its result to the `Field` built in
`from_substrait_struct_type`, via `Field::with_metadata`.
- Existing consumers are unaffected: the default keeps today's behavior
exactly (no metadata attached).

## Are these changes tested?

Yes, two new unit tests: a consumer that supplies metadata for a
`UserDefined` field gets it attached to the field (data type unchanged),
and a consumer returning `None` (the default) attaches nothing.

## Are there any user-facing changes?

No behavior change for existing consumers. This is a new, optional trait
method with a default implementation.

(cherry picked from commit d682553)
@codecov-commenter

codecov-commenter commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.10811% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.15%. Comparing base (3a95ddd) to head (a4f8f62).

Files with missing lines Patch % Lines
...usion/substrait/src/logical_plan/consumer/types.rs 88.30% 11 Missing and 9 partials ⚠️
...ubstrait/src/logical_plan/consumer/expr/literal.rs 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           branch-55     #179    +/-   ##
===========================================
  Coverage      81.15%   81.15%            
===========================================
  Files           1110     1110            
  Lines         386489   386654   +165     
  Branches      386489   386654   +165     
===========================================
+ Hits          313636   313806   +170     
  Misses         54362    54362            
+ Partials       18491    18486     -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@moraistejerina
moraistejerina merged commit d7eb121 into branch-55 Sep 8, 2026
68 checks passed
@moraistejerina
moraistejerina deleted the jorge.morais/cherry-pick/apache-pr-25015-branch-55-20260908 branch September 8, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants