apache / apache/datafusion

FFI: `FFI_WindowUDF` silently drops producer overrides of defaulted trait methods

Open
#22,332 4 comments 0 reactions 1 assignee Claimed by @Brijesh-Thakkar View on GitHub
enhancement ffi functions
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

## Gap

`FFI_WindowUDF` in `datafusion/ffi/src/udwf/mod.rs` does not plumb several defaulted methods of `WindowUDFImpl`. Producer overrides are silently lost on the consumer side.

## Missing methods

- `simplify`
- `expressions`
- `reverse_expr`
- `documentation`

## Why it matters

**Severity: important.** `expressions()` selects which physical expressions reach the `PartitionEvaluator` — silent fallback can change window-function semantics. `simplify` and `reverse_expr` are planner hooks. `documentation` is cosmetic but cheap to add.

## Implementation notes

- Plumb each as a plain `unsafe extern \"C\" fn`; wrapper body calls the trait method on inner `Arc` and dispatch handles override-or-default.
- `expressions` returns `Vec>` — relies on the existing `FFI_PhysicalExpr` plumbing.
- `simplify` / `reverse_expr` ship `Expr` — require the embedded `FFI_LogicalExtensionCodec`.
- Layout change → `api change` label, target `main` only, no back-port to `branch-`.
- Add unit tests (local-bypass + `mock_foreign_marker_id` forced-foreign) **and** integration tests under `datafusion/ffi/tests/`.

---

Generated from `datafusion-ffi` skill audit. See `.ai/skills/datafusion-ffi/SKILL.md` §"Method coverage" and §"Known gaps to close" (originated in PR #22327). If a PR addressing this finds any item to be a false positive (e.g., a method intentionally omitted for a documented reason), please also propose an update to the `datafusion-ffi` skill so future audits do not re-flag it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.