You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by ti...@apache.org on 2026/09/04 20:09:29 UTC

(datafusion-python) 01/02: Stop claiming _install_extensions always writes state

This is an automated email from the ASF dual-hosted git repository.

timsaucer pushed a commit to branch feat/ffi-with-extensions
in repository https://gitbox.apache.org/repos/asf/datafusion-python.git

commit d8f32cca09747ea4d4d1eac3e6d244d3d0d2f6b6
Author: Tim Saucer <ti...@gmail.com>
AuthorDate: Fri Sep 4 16:03:29 2026 -0400

    Stop claiming _install_extensions always writes state
    
    The doc comment said "the final state is written through this context's own
    `state_ref()`", which overstates it. `set_session_query_planner` returns early
    when there is no planner to bind, and the codec chains live on the returned
    `PySessionContext` fields rather than in `SessionState` — so a codec-only
    install onto a session with no FFI planner writes nothing.
    
    Co-Authored-By: Claude Opus 5 (1M context) <no...@anthropic.com>
---
 crates/core/src/context.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/crates/core/src/context.rs b/crates/core/src/context.rs
index 4c0605e7..4fb40ae3 100644
--- a/crates/core/src/context.rs
+++ b/crates/core/src/context.rs
@@ -1620,9 +1620,15 @@ impl PySessionContext {
     /// the context the extensions bound their components against, and is also
     /// the `Arc<SessionContext>` every FFI task-context provider they created
     /// targets, so the returned handle shares it rather than deriving a new
-    /// one. Codec capsules are imported and validated before any state change,
-    /// so a failure leaves the session untouched. The final state is written
-    /// through this context's own `state_ref()`, so those providers stay
+    /// one. Codec capsules are imported and validated before anything is
+    /// committed, so a failure leaves the session untouched.
+    ///
+    /// The codec chains belong to the returned handle rather than to
+    /// `SessionState`, so a codec-only install onto a session with no FFI
+    /// planner writes no state at all. The session is written only when there
+    /// is a planner to bind — one a bundle supplied, or one already installed
+    /// that has to be rebuilt against the new chains — and that write goes
+    /// through this context's own `state_ref()`, so providers bound to it stay
     /// valid.
     #[pyo3(signature = (logical_codecs, physical_codecs, planner=None))]
     pub fn _install_extensions<'py>(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org