Skip to content

refactor: move AdaptivePlanner's test-only methods into the AQE test module - #2666

Merged
andygrove merged 1 commit into
apache:mainfrom
andygrove:refactor/aqe-planner-test-helpers
Oct 26, 2026
Merged

andygrove merged 1 commit into
apache:mainfrom
andygrove:refactor/aqe-planner-test-helpers

Conversation

@andygrove

Copy link
Copy Markdown
Member

Which issue does this PR close?

No issue; a cleanup noticed while reviewing #2664.

Rationale for this change

AdaptivePlanner carried four methods used only by tests (try_from_plan, runnable_stages, inspect_runnable_stages, current_plan), compiled in behind #[cfg(test)] inside the production impl in planner.rs, along with a #[cfg(test)] import. Test-only code is easier to find and keeps the production file smaller when it lives with the tests that use it.

What changes are included in this PR?

  • The four methods move, unchanged in behaviour, into a test-only impl AdaptivePlanner block in ballista/scheduler/src/state/aqe/test/mod.rs, where all their callers are. They become pub(super) (they were pub/pub(crate) but only compiled under test).
  • default_optimizers, find_runnable_exchanges and the RunnableStages alias become pub(super) so the test module can use them. The plan field was already pub(crate).
  • planner.rs no longer has any #[cfg(test)] items.

Covered by the existing AQE tests, which call these methods throughout; no test changes were needed beyond the move.

Are there any user-facing changes?

No. The moved methods were only compiled under #[cfg(test)], so no public API changes.

…module

try_from_plan, runnable_stages, inspect_runnable_stages and current_plan
were only used by tests but lived in planner.rs behind #[cfg(test)]. They
now live in a test-only impl block in aqe/test/mod.rs, next to their
callers. default_optimizers, find_runnable_exchanges and the
RunnableStages alias become pub(super) so the test module can use them.

@milenkovicm milenkovicm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks

@andygrove
andygrove added this pull request to the merge queue Oct 26, 2026
Merged via the queue into apache:main with commit a6d322b Oct 26, 2026
25 checks passed
@andygrove
andygrove deleted the refactor/aqe-planner-test-helpers branch October 26, 2026 22:49
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.

2 participants