Skip to content

fix: forward physical optimizer context through tracing wrappers - #69

Open
alexanderbianchi wants to merge 1 commit into
datafusion-contrib:mainfrom
alexanderbianchi:fix/forward-physical-optimizer-context
Open

alexanderbianchi wants to merge 1 commit into
datafusion-contrib:mainfrom
alexanderbianchi:fix/forward-physical-optimizer-context

Conversation

@alexanderbianchi

Copy link
Copy Markdown

Summary

Physical optimizer tracing wrappers currently inherit the default optimize_with_context, which reduces the context to ConfigOptions and calls optimize. This loses access to a session's registered StatisticsRegistry. For example, JoinSelection can then fall back to built-in statistics providers even though a custom registry was configured.

Forward optimize_with_context through both the phase-only error-cleanup wrapper and the full instrumentation wrapper. Share each wrapper's handling between entry points so legacy optimize calls retain their behavior, and context-aware calls retain tracing, plan-diff detection, and error cleanup.

Tests

Four new regressions exercise the public instrumentation macro and query execution in phase-only/full modes:

  • A registered statistics provider is invoked and its statistics reach the optimizer rule; phase/rule spans close normally.
  • Provider failures propagate, close the planning phase, reset tracking, and allow a subsequent query to succeed.

All four fail on the unpatched base. Existing config-only physical optimizer error tests remain in place.

Validation:

  • cargo test --locked --workspace --all-targets
  • cargo test --locked --workspace --doc
  • ./ci/scripts/rust_clippy.sh
  • ./ci/scripts/rust_docs.sh
  • cargo fmt --all -- --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant