apache / apache/datafusion-python
Expose SessionContext.add_optimizer_rule for Python-defined logical optimizer rules
- Linguagem predominante
- Python
- Estrelas
- 604
- Forks
- 174
- Merge médio
- 1d 7h
- PRs com merge (30d)
- 4
Descrição
## 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`).
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Comece revisando o binding Python existente para SessionContext.remove_optimizer_rule e o trabalho de add_physical_optimizer_rule em PR #1557. Retome esta issue quando o upstream fornecer FFI_OptimizerRule e construtores Python LogicalPlan; considera-se concluída quando regras lógicas definidas em Python puderem ser registradas por meio de add_optimizer_rule e executadas por meio do binding.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python, rust
- Domínio
- data-engineering
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Pouca atividade
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 25/100