Skip to content

Commit 39a1f75

Browse files
authored
Implement FFI_Session (#19223)
## Which issue does this PR close? Addresses part of #18671 but does not close it. ## Rationale for this change One of the reasons we are unable to remove `SessionContext` from the FFI crate is that we rely on building a session in the `TableProvider::scan` function. This is because our current implementation uses `FFI_SessionConfig` and passes around a hashmap of String->String values of config options. Then in the other side of the FFI boundary we build a temporary session. This is not ideal because those table provider cannot utilize the actual current session. By implementing a FFI safe version of the `Session` trait we can overcome this limitation. ## What changes are included in this PR? - Implement `FFI_Session` This PR does _not_ use these structures in the current code. That is coming as part of a later PR in an effort to keep the size of the PRs small for effective code review. ## Are these changes tested? Unit tests are added. Coverage report: <img width="531" height="185" alt="Screenshot 2025-12-09 at 8 35 56 AM" src="https://github.com/user-attachments/assets/1b6de980-e048-49cf-a8fe-961d5e902e06" /> ## Are there any user-facing changes? No.
1 parent c1aa1b5 commit 39a1f75

File tree

7 files changed

+612
-3
lines changed

7 files changed

+612
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/ffi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ datafusion-physical-expr-common = { workspace = true }
5858
datafusion-physical-plan = { workspace = true }
5959
datafusion-proto = { workspace = true }
6060
datafusion-proto-common = { workspace = true }
61+
datafusion-session = { workspace = true }
6162
futures = { workspace = true }
6263
log = { workspace = true }
6364
prost = { workspace = true }

datafusion/ffi/src/execution/task_ctx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use datafusion_expr::{
2828
AggregateUDF, AggregateUDFImpl, ScalarUDF, ScalarUDFImpl, WindowUDF, WindowUDFImpl,
2929
};
3030

31-
use crate::session_config::FFI_SessionConfig;
31+
use crate::session::config::FFI_SessionConfig;
3232
use crate::udaf::FFI_AggregateUDF;
3333
use crate::udf::FFI_ScalarUDF;
3434
use crate::udwf::FFI_WindowUDF;

datafusion/ffi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub mod plan_properties;
3737
pub mod proto;
3838
pub mod record_batch_stream;
3939
pub mod schema_provider;
40-
pub mod session_config;
40+
pub mod session;
4141
pub mod table_provider;
4242
pub mod table_source;
4343
pub mod udaf;

0 commit comments

Comments
 (0)