ntjohnson1 commented on code in PR #1546:
URL: 
https://github.com/apache/datafusion-python/pull/1546#discussion_r3293069846


##########
python/datafusion/ipc.py:
##########
@@ -125,6 +158,67 @@ def get_worker_ctx() -> SessionContext | None:
     return getattr(_local, "ctx", None)
 
 
+def set_sender_ctx(ctx: SessionContext) -> None:
+    """Install this driver's :class:`SessionContext` for outbound pickles.
+
+    Controls how :func:`pickle.dumps` encodes :class:`Expr` instances on
+    this thread. The most useful application is propagating a session
+    configured with
+    :meth:`SessionContext.with_python_udf_inlining` so the toggle takes
+    effect through pickle (which otherwise calls
+    :meth:`Expr.to_bytes` with no context and uses the default codec).
+
+    Idempotent: overwrites any previous value. Stored in a thread-local
+    slot, so worker threads on the driver may install their own contexts.
+    Does not affect :meth:`Expr.to_bytes` calls that pass an explicit
+    ``ctx`` — those continue to use the supplied context.
+
+    Examples:
+        >>> from datafusion import SessionContext
+        >>> from datafusion.ipc import (
+        ...     set_sender_ctx, get_sender_ctx, clear_sender_ctx,
+        ... )
+        >>> driver = SessionContext().with_python_udf_inlining(enabled=False)
+        >>> set_sender_ctx(driver)
+        >>> get_sender_ctx() is driver
+        True
+        >>> clear_sender_ctx()

Review Comment:
   Does skipping this step cause other doc tests to fail and this is basically 
cleanup? If not looks unneeded for this doc string



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to