apache / apache/datafusion

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

Open
#22,328 1 comment 0 reactions 1 assignee Claimed by @Amogh-2404 View on GitHub
enhancement ffi
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

## Gap

`FFI_TableProvider` in `datafusion/ffi/src/table_provider.rs` does not plumb several defaulted methods of `TableProvider`. When a producer overrides one of these, the consumer-side `ForeignTableProvider` falls back to the trait default, silently losing the override.

## Missing methods

- `constraints`
- `get_table_definition`
- `get_logical_plan`
- `get_column_default`
- `scan_with_args`
- `statistics`
- `delete_from`
- `update`
- `truncate`

## Why it matters

**Severity: critical.** The three DML methods (`delete_from`, `update`, `truncate`) silently demote a writable foreign table to read-only. `statistics` and `constraints` break cost-based optimization. `get_logical_plan` / `get_table_definition` / `get_column_default` break view + DDL features.

## Implementation notes

- Per the FFI skill: plumb every defaulted method as a plain `unsafe extern \"C\" fn`. The wrapper body calls `inner.method(...)` and `Arc` dynamic dispatch picks override-or-default for free. Do **not** use `Option` unless there is a corresponding constructor capability flag.
- This is an `FFI_X` struct layout change. PR must:
- Carry the `api change` label.
- Target `main` only — not back-portable to `branch-`.
- Add unit tests (local-bypass + forced-foreign via `mock_foreign_marker_id`).
- Add integration tests under `datafusion/ffi/tests/` exercising the new methods through the cdylib (`cargo test -p datafusion-ffi --features integration-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.