Skip to content

Commit 108cd13

Browse files
timsaucerclaude
andcommitted
docs: move FFI capsule detail to PhysicalOptimizerRuleExportable
The PyCapsule / FFI_PhysicalOptimizerRule mechanics describe the Protocol, not the SessionContext constructor. Move that detail onto PhysicalOptimizerRuleExportable and leave the constructor argument docs focused on behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0a7e45d commit 108cd13

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

python/datafusion/context.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ def __datafusion_table_provider__(self, session: Any) -> object: ... # noqa: D1
133133
class PhysicalOptimizerRuleExportable(Protocol):
134134
"""Type hint for object that has __datafusion_physical_optimizer_rule__ PyCapsule.
135135
136-
The capsule wraps an ``FFI_PhysicalOptimizerRule``, typically produced by a
137-
separate compiled extension.
136+
The method returns a PyCapsule wrapping an ``FFI_PhysicalOptimizerRule``,
137+
typically produced by a separate compiled extension. DataFusion provides no
138+
FFI bridge for logical optimizer or analyzer rules, so only physical
139+
optimizer rules can be supplied this way.
138140
"""
139141

140142
def __datafusion_physical_optimizer_rule__(self) -> object: ... # noqa: D105
@@ -546,14 +548,10 @@ def __init__(
546548
config: Session configuration options.
547549
runtime: Runtime configuration options.
548550
physical_optimizer_rules: User-defined physical optimizer rules to
549-
append to the default set. Each item is a
550-
:class:`PhysicalOptimizerRuleExportable` — an object exposing a
551-
``__datafusion_physical_optimizer_rule__`` method that returns a
552-
PyCapsule around a ``FFI_PhysicalOptimizerRule`` (typically built
553-
in a separate compiled extension). DataFusion provides no FFI
554-
bridge for logical optimizer or analyzer rules, and there is no
555-
upstream API to add physical rules to a live context, so these
556-
can only be supplied at construction time.
551+
append to the default set, each a
552+
:class:`PhysicalOptimizerRuleExportable`. There is no upstream
553+
API to add physical rules to a live context, so these can only
554+
be supplied at construction time.
557555
558556
Example usage:
559557

0 commit comments

Comments
 (0)