Skip to content

Commit bcc4755

Browse files
timsaucerclaude
andcommitted
docs: clarify strict-mode refusal message and to_bytes inlining docs
Address PR review feedback: - codec.rs: rewrite strict-refusal error to present the two real remediations (sender re-encode by-name + receiver register; or receiver enables inlining, accepting cloudpickle risk) instead of bundling registration with both-side inlining. - expr.py: qualify to_bytes docstring so Python UDF self-contained behavior is conditional on with_python_udf_inlining being enabled. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8827726 commit bcc4755

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

crates/core/src/codec.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,12 @@ fn refuse_inline_payload(kind: &str, name: &str) -> datafusion::error::DataFusio
413413
// error would mis-route it into "fix your SQL" buckets.
414414
datafusion::error::DataFusionError::Execution(format!(
415415
"Refusing to deserialize inline Python {kind} '{name}': Python UDF \
416-
inlining is disabled on this session. Ask the sender to re-encode \
417-
with inlining disabled (so the UDF travels by name), or register \
418-
'{name}' on this receiver's session and enable inlining on both \
419-
sides — receivers cannot re-encode bytes they did not produce."
416+
inlining is disabled on this session. Two remediations: \
417+
(1) ask the sender to re-encode with inlining disabled so '{name}' \
418+
travels by name, and register '{name}' on this receiver; or \
419+
(2) enable inlining on this receiver (accepts the cloudpickle \
420+
execution risk on inbound payloads). Receivers cannot re-encode \
421+
bytes they did not produce."
420422
))
421423
}
422424

python/datafusion/expr.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,13 @@ def to_bytes(self, ctx: SessionContext | None = None) -> bytes:
452452
When ``ctx`` is ``None``, the default codec is used (Python UDF
453453
inlining on, no user-installed extension codec).
454454
455-
Built-in functions and Python UDFs (scalar, aggregate, window)
456-
travel inside the returned bytes; the worker does not need to
457-
pre-register them. UDFs imported via the FFI capsule protocol
458-
travel by name only and must be registered on the worker.
455+
Built-in functions travel inside the returned bytes. Python UDFs
456+
(scalar, aggregate, window) also inline by default, so the worker
457+
does not need to pre-register them; when the encoding session has
458+
:meth:`SessionContext.with_python_udf_inlining` set to ``False``,
459+
Python UDFs travel by name only and must be registered on the
460+
worker. UDFs imported via the FFI capsule protocol always travel
461+
by name only and must be registered on the worker.
459462
460463
.. warning:: Security
461464
Bytes returned here may embed a cloudpickled Python

0 commit comments

Comments
 (0)