Add optimize_with_context to FFI_PhysicalOptimizerRule#22584
Conversation
Plumb `optimize_with_context` through the FFI boundary so that foreign physical optimizer rules can access the PhysicalOptimizerContext (including the statistics registry). Previously only the context-free `optimize` was exposed, silently discarding overrides of the context-aware variant. Closes apache#22334
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
There was a problem hiding this comment.
@nathanb9
Thanks for the follow-up updates. The original review comments look resolved, and the new integration test covers the important cross-library path nicely.
I found a couple of follow-up issues that seem worth fixing before this lands, mostly around unused API surface and avoidable cloning.
|
|
||
| pub create_physical_optimizer_rule: extern "C" fn() -> FFI_PhysicalOptimizerRule, | ||
|
|
||
| pub create_context_aware_optimizer_rule: extern "C" fn() -> FFI_PhysicalOptimizerRule, |
There was a problem hiding this comment.
ForeignLibraryModule gained a required public field here, so existing struct literal construction would break. cargo-semver-checks flags this as constructible_struct_adds_field.
The API change label covers this, and I realize this lives under the test module for cross-library integration coverage. Just calling it out so the public API impact is explicit.
Which issue does this PR close?
Closes #22334
Rationale for this change
FFI_PhysicalOptimizerRuleonly plumbedoptimize,name, andschema_check— notoptimize_with_context. Foreign rules that override the context-aware variant had their override silently discarded.What changes are included in this PR?
FFI_PhysicalOptimizerContextstruct to pass optimizer context (config + statistics registry) across FFIoptimize_with_contextfunction pointer toFFI_PhysicalOptimizerRuleForeignPhysicalOptimizerRulenow overridesoptimize_with_contextto route through FFIAre these changes tested?
Yes — two new tests (
test_optimize_with_context_round_trip,test_optimize_with_context_with_registry) plus all existing tests continue to pass.Are there any user-facing changes?
API change:
FFI_PhysicalOptimizerRulegains a new field (optimize_with_context). This is a layout change for any external consumer of this struct.