apache / apache/datafusion-python
Expose SessionContext.add_optimizer_rule for Python-defined logical optimizer rules
- 主要語言
- Python
- 星號
- 604
- 分支
- 174
- 平均合併
- 1 天 7 小時
- 30 天內合併 PR
- 4
描述
## 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`).
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
先查看現有的 SessionContext.remove_optimizer_rule Python binding,以及 PR #1557 中 add_physical_optimizer_rule 的工作。待 upstream 提供 FFI_OptimizerRule 和 Python LogicalPlan 建構函式後,再重新處理此 issue;當以 Python 定義的邏輯規則可以透過 add_optimizer_rule 註冊並透過該 binding 執行時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python, rust
- 領域
- data-engineering
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100