apache / apache/datafusion-python
Quarantine the greedy ForeignExecutionPlan claim so it cannot be copied by accident
- 主要語言
- Python
- 星號
- 604
- 分支
- 174
- 平均合併
- 1 天 7 小時
- 30 天內合併 PR
- 4
描述
`examples/datafusion-ffi-example/src/physical_extension_codec.rs:150` claims `node.is::() || node.is::()`. The second arm takes every other library's nodes, which `extension-guide/checklist.md` tells authors never to do.
**This is not a bug to fix.** It is G2 in #1719: the arm is load-bearing for upstream defect apache/datafusion#25152, and narrowing it to `DataSourceExec` alone makes 31 of the 51 tests in `datafusion-ffi-query-planner-example` fail. The object registry in the same file is downstream of it — once you claim a node you cannot introspect, there is nothing to write down about it, so parking it is all that is left.
The goal is to make it impossible to copy by accident while it stays. Proposal: move the statics and helpers into a new `src/foreign_plan_workaround.rs` behind three deliberately blunt functions — `claims()`, `park()`, `take()`. Nobody reads `foreign_plan_workaround::park(node, buf)` and thinks they are looking at serialization. The 25-line explanation currently buried inside a function body at lines 125-149 becomes the module `//!` doc, with three greppable fields:
```rust
//! # NOT A PATTERN
//! **Blocked on:**
//! **Delete when:** `FFI_PlanProperties` carries `scheduling_type`, or
//! `ForeignExecutionPlan` gains a reachable `try_to_proto`.
//! **Copying this will:** claim every other library's plan nodes, and produce
//! payloads that decode only in the writing process, exactly once each.
```
One honesty note belongs in that doc: the `DataSourceExec` arm *could* be durable and is not, because the registry has to exist for the `ForeignExecutionPlan` arm regardless. Splitting the two arms across two wire formats costs real code and removes nothing. Saying so lets the guide claim the registry cannot be removed without also claiming every byte of it is forced.
**Do not rename `MyPhysicalExtensionCodec`** — 21 call sites plus two doc references, and the module doc already carries the label.
**Done when:** `grep -rn "NOT A PATTERN" examples/` returns exactly one site, and `cargo clippy --no-deps --all-targets` is clean. No test changes expected; this is code motion plus documentation.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 examples/datafusion-ffi-example/src/physical_extension_codec.rs:125-150 以及 extension-guide/checklist.md 中的相關指引開始。追蹤 MyPhysicalExtensionCodec 使用的 statics 和 helpers,然後依照指定的模組文件,將 workaround 隔離到 src/foreign_plan_workaround.rs 中 claims()、park() 和 take() 的後面。完成標準是 grep 在 examples/ 中恰好找到一個 “NOT A PATTERN”,並且 cargo clippy --no-deps --all-targets 通過且沒有問題。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- backend-api-design
- Issue 類型
- 重構
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 72/100