apache / apache/datafusion-python
Expose SessionContext.add_optimizer_rule for Python-defined logical optimizer rules
- Langage dominant
- Python
- Étoiles
- 604
- Forks
- 174
- Merge moyen
- 1 j 7 h
- PR mergées (30 j)
- 4
Description
## Background
`SessionContext::add_optimizer_rule` registers an `Arc` that runs during logical plan optimization. The Python bindings only expose `remove_optimizer_rule`, never the additive side. PR #1557 ultimately landed `add_physical_optimizer_rule` for the physical pipeline via FFI but did not address the logical pipeline.
## Upstream signature
```rust
pub fn add_optimizer_rule(&self, optimizer_rule: Arc)
```
## User value
Lets users add domain-specific logical rewrites (predicate normalization, redundant join elimination, scan pruning informed by external metadata) without forking DataFusion. Complements the existing `remove_optimizer_rule` to round out the surface.
## Why deferred
Blocked upstream. As documented in PR #1557, DataFusion does not currently expose an FFI bridge for the logical `OptimizerRule` / `AnalyzerRule` traits, and there are no Python constructors for `LogicalPlan` node variants -- a pure-Python rule could observe plans but not transform them. The PR #1557 commit history shows an initial attempt at a Python-defined logical rule that was abandoned for this reason. This is filed for tracking; it should be revisited once upstream lands an `FFI_OptimizerRule` (mirroring `FFI_PhysicalOptimizerRule`).
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Start by reviewing the existing Python binding for SessionContext.remove_optimizer_rule and the add_physical_optimizer_rule work in PR #1557. Revisit this issue once upstream provides FFI_OptimizerRule and Python LogicalPlan constructors; done means Python-defined logical rules can be registered through add_optimizer_rule and exercised through the binding.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python, rust
- Domaine
- data-engineering
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Calme
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 25/100