Skip to content

[branch-55] fix(ffi): use the session's LogicalExtensionCodec in create_physical_plan (#24690) - #24694

Merged
alamb merged 1 commit into
apache:branch-55from
timsaucer:fix/ffi-session-create-physical-plan-codec-55
Aug 26, 2026
Merged

[branch-55] fix(ffi): use the session's LogicalExtensionCodec in create_physical_plan (#24690)#24694
alamb merged 1 commit into
apache:branch-55from
timsaucer:fix/ffi-session-create-physical-plan-codec-55

Conversation

@timsaucer

Copy link
Copy Markdown
Member

This PR is a cherry-pick of #24690 onto branch-55. See the original PR for a description of the issue.

…plan (apache#24690)
## Which issue does this PR close?
- Closesapache#24688.
## Rationale for this change
A foreign library that holds an FFI session reference cannot call
`Session::create_physical_plan` for any plan that references a custom
table provider or other extension node. Planning fails with:
> This feature is not implemented: LogicalExtensionCodec is not provided
## What changes are included in this PR?
In `datafusion/ffi/src/session/mod.rs`, we now serialize and deserialize
logical plans using codecs. This matches what `optimize_fn_wrapper` and
`ForeignSession::optimize` already do.
## Are these changes tested?
Yes. A new unit test,
`session::tests::test_create_physical_plan_uses_logical_codec`,
registers a `MemTable` that can only be serialized by a custom codec,
wraps the session in an `FFI_SessionRef` carrying that codec, and plans
a scan of it through
`ForeignSession::create_physical_plan`.
The test was verified to reproduce the bug: with either half of the fix
reverted it fails.
## Are there any user-facing changes?
No API changes. `Session::create_physical_plan` over FFI now works for
plans that require the session's `LogicalExtensionCodec` instead of
returning a not-implemented error. No breaking changes.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actionsgithub-actionsBot added the ffi Changes to the ffi crate label Aug 26, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.16%. Comparing base (045b590) to head (24d8903).

Files with missing linesPatch %Lines
datafusion/ffi/src/session/mod.rs75.00%0 Missing and 7 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## branch-55 #24694 +/- ##
=============================================
- Coverage 81.16% 81.16% -0.01% 
=============================================
Files 1110 1110 Lines 386911 386935 +24 Branches 386911 386935 +24 =============================================
+ Hits 314050 314065 +15 - Misses 54370 54374 +4 - Partials 18491 18496 +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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timsaucertimsaucer added the bug Something isn't working label Aug 26, 2026

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @timsaucer and @saadtajwar

@alamb
alamb merged commit 20268a7 into apache:branch-55Aug 26, 2026
34 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingffiChanges to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@timsaucer@codecov-commenter@alamb@saadtajwar