Repository navigation
feat: price joint execution DAGs directly in MILP - #935
Merged
Merged
Conversation
…p-decomposition # Conflicts: # docs/design_docs/proposals/joint-planning-search.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR
Approximate candidates received an extra search surcharge, and the rollup-heavy viewer workload could return separate exact aggregates despite a cheaper valid shared KMV plan. Complete DAG costs depended on evaluator refinement. The document did not define safe local DP boundaries.
After this PR
Accuracy is feasibility without an approximate-candidate surcharge. The original 30-second viewer workload selects a shared KMV build and regrouping merge while retaining both accuracy targets. MILP directly prices certified complete DAGs using execution demand, temporary state lifetime, resident state, raw-retention maxima, and request overhead; decoded prices are checked against the complete evaluator.
Production acceptance now also covers SQL distinct rollup, three SQL KLL groupings, and PromQL host/job quantiles. The SQL cases select shared rollups. The PromQL fixture explicitly supplies held-row facts, beats independently built KLLs, and permits a cheaper validated exact plan instead of forcing approximation.
Implemented scope and remaining limits
Scenarios handled by this PR
(service, endpoint)distinct counts and coarseservicecounts(region, service)andservice(region, service),region, andservice(host, job)andjob, with explicit held-row factsNot covered: differing range contexts, retained-query-time range refresh, arbitrary supplier-dependent output/worker configurations, large rate lattices, and large mixtures of non-fixed recurrences. These remain evaluator-refined; this PR does not claim full-catalog direct-cost optimality.
Key code interfaces added / modified
search/costing/direct_profile.rs.search/milp/direct_cost.rs,direct_schedule.rs,direct_fixed_schedule.rs.search/candidates/accuracy_configurations.rs, graph/configuration handling, MILP, and refinement integration.rollup_controlled.rs,production_rollup_workloads.rs.Major algorithm changes
Jointly price node activation, execution boundaries, consumer demand, state lifetime, and shared resources. Certified scan-price classes share one planning budget while preserving the full refinement catalog. Apply selected-consumer materialization constraints before evaluation, and generate scoped capacities before pricing.
Validation
CI presentation-test follow-up
The display-cap scenario now uses two instant quantiles in exhaustive mode, retaining assertions for a real cap, the selected plan, and archived DAG links without expanding window panes. The per-node cost scenario uses the normal bounded planner and retains its timing/CPU accounting checks. Both focused tests pass (0.30s and 30.12s). This changes test fixtures, not production planning or costs. Full CI is rerunning; the original CI artifacts did not establish the precise cause of the empty selections.
Interrupted evaluation archive consistency
A compiler deadline can interrupt evaluation after a physical plan is reconstructed. Such a plan now stays out of the evaluated archive until its selector offer completes; completed accepted and rejected plans remain archived. The same rule applies after complete-catalog calibration. This preserves the viewer contract that every archived physical plan has either a cost or a rejection.
A deterministic compiler-timeout regression fails before the fix and passes afterward. All 10 objective-search tests pass, including both frozen and complete-calibration timeout cases. The original example-1 archive accounting test passes unchanged (30.56s).
CI repair and current-main integration
Scenario: three repeated/different-window SQL COUNT DISTINCT outputs with an explicit confidence target and a 10-second planning budget. A feasibility seed previously kept choosing estimators with an unresolved confidence contract. The seed now excludes those proposals; the complete catalog and final accuracy validation remain unchanged, and there is no approximate-candidate price surcharge. Includes latest main (#938 family capability consistency). This preserves the original test budget and accuracy requirements.
Candidate-cost overflow recovery
Scenario: Example 2 can select a physical configuration whose analytical cost arithmetic overflows. Previously that stopped search before a usable incumbent. Scalar-price search now skips the unpriceable assignment, records
cost_not_representable, and continues looking for a validated plan. Unknown cost is not infeasibility: exclusions of unpriceable assignments invalidate full-domain optimality/infeasibility claims and reset the reported bound conservatively. Other evaluator errors remain fatal. The new regression covers both a later feasible candidate and an entirely unpriceable domain; Example 2 retains its original requirements and budget.TopK contract regression
Scenario: a temporal TopK search visits a tighter error allocation first, with heap capacity 200 instead of the default 100. The integration test now verifies every visited heap-backed candidate preserves the requested k, minimum capacity, entity identity and update expression, rather than requiring a fixed first-candidate capacity. Default sizing remains covered by its unit test. The original assertion failed locally; all 13 tests in
promql_to_post_asappass after this correction.Stable sketch execution and coverage fixtures
Scenarios: a search archive may contain tightened, large sketch configurations or multiple KLL capacities. Rollup execution and coverage tests now use the existing explicit local-rule fixtures, so they test all intended sketch rules and coverage semantics without depending on solver visitation. The rollup memory limit and result assertions remain unchanged. The former fixtures failed locally; corrected rollup (3) and coverage (8) tests pass. The integration package was exercised in batches: 330 passed, 23 pre-existing ignored; affected tests also pass strict clippy. Full remote CI passed on this head before merge.