timsaucer opened a new issue, #22334: URL: https://github.com/apache/datafusion/issues/22334
## Gap `FFI_PhysicalOptimizerRule` in `datafusion/ffi/src/physical_optimizer.rs` plumbs `optimize`, `name`, and `schema_check`, but not `optimize_with_context`. Producers that override the context-aware variant have their override silently discarded — the consumer side always takes the context-free path. ## Missing method - `optimize_with_context` ## Why it matters **Severity: important.** `optimize_with_context` gives an optimizer rule access to the per-invocation context (statistics registry, plan-time options) that `optimize` does not see. Rules that produce different output depending on available statistics are silently downgraded across the FFI boundary. ## Implementation notes - Plumb as `unsafe extern \"C\" fn`; wrapper body calls `inner.optimize_with_context(...)`. - The context type needs an FFI representation. If a `FFI_OptimizerContext` does not yet exist, this issue subsumes the plumbing work for it. - Layout change → `api change` label, target `main` only, no back-port to `branch-<major>`. - Add unit tests (local-bypass + `mock_foreign_marker_id` forced-foreign) **and** integration test exercising a rule whose behavior depends on the context. --- Generated from an audit performed for PR #22327 (datafusion-ffi agent skill). If a PR addressing this finds the omission to be a false positive (e.g., the context cannot safely cross the boundary), please also propose an update to the `datafusion-ffi` skill so future audits do not re-flag it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
