Repository navigation
feat: Pass 1 prunes summaries no reading query can use for its accuracy target - #1116
Merged
zzylol merged 2 commits intoOct 30, 2026
Merged
Conversation
…y target Pass 1 now removes a summary candidate (own or fused) when, for every query whose root reaches its aggregate group, the query's output composed with that summary (every other target exact) has no error bound that can meet the query's target at any size: guarantee propagation has no rule above it (e.g. a rank error through avg, a value HAVING over an estimate), its bound stays unknown once the data workload's sign declarations are bound (a relative error through avg over an undeclared gauge), or its metric is not one the target accepts. Other symbolic statistics are assumed bindable. A summary one reading query can use is kept; exact candidates are never pruned. The reason is the new PruneReason::NoErrorBoundForQueryTarget, carried in Pass 1's pruned_candidates. The facade prunes only when Stage 3's accuracy model and evidence cannot accept an output without its guarantee (not with ignore_accuracy_guarantees). Stage 3 reports a query root group left with no candidate as no valid candidate rather than a solver failure. The two no-raw avg-of-p99 runtime_install tests assert the reason again, on the facade's MemoSteps::pass1_pruned_candidates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bqhAk7WA4MZcfbAoMw
… check whole-result scope Follow-ups to the structural accuracy prune: - Pass 1 cannot see Pass 2's reuse of one group's summary by another (rollup, window rollup, finer-aggregate reuse, top-k reuse). A summary is now kept whenever another target, over another aggregate reading one of the same sources, offers the same family. This keeps more than those rules' preconditions need and relies on no dominance argument. - The metric check asks the deployment's accuracy model through a new default method, AccuracyModel::metric_can_meet. Its default is the built-in rule; the facade passes the model Stage 3 uses. - The guarantee is stated over the target's scope, as Stage 3 states it. A per-value guarantee that may fail cannot meet a whole-result failure probability over a number of values the data does not bound, so it is pruned with the same reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bqhAk7WA4MZcfbAoMw
This was referenced Oct 30, 2026
Open
zzylol
added a commit
that referenced
this pull request
Oct 30, 2026
…ng guarantees (#1118) #1116 makes Pass 1 prune a summary no reading query can use for its accuracy target when guarantees are enforced. Seven integration tests read the reference enumeration under the built-in strict model to check the structure or execution of a summary whose output Stage 3 already rejected at that target before #1116: a heap-backed Top-K and a value filter or group key over an estimate have no guarantee, and a grouped KLL quantile's per-value guarantee meets no whole-result target over groups the data does not bound. Pass 1 now prunes those summaries, so the tests found no candidate. The tests now plan with every output accepted (logical_candidates_ignoring_guarantees, ignore_accuracy_guarantees), as they check rewrites and execution, not accuracy acceptance. Claude-Session: https://claude.ai/code/session_01K1M6bqhAk7WA4MZcfbAoMw Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #1047 (per-query accuracy pruning in Pass 1) and #1095 §2.0 (accuracy A1). Merges into
refactor/stage-boundaries.Why
#1095's MILP checks accuracy with linear rows that count the budget shares a query uses. That works only if every candidate reaching Stage 3 can meet some query's target. Today, structurally hopeless candidates still reach Stage 3, which rejects them as
no_accuracy_guarantee/AccuracyTargetMissed. Examples are a heap top-k with no guarantee, a relative bound under a rank target, and a relative bound throughavgover an undeclared gauge. Under the new design these belong to Pass 1, which also states the reason.What
The rule:
PerComputationCandidates::without_summaries_no_query_can_useprunes a summary when no query that reaches its aggregate group can use it. For each such query, Pass 1 composes the output with only that summary approximate (the most favorable case). The query cannot use the summary if any of these holds:None;AccuracyModel::metric_can_meet, new, whose default keeps the built-in rule);What is never pruned:
Other changes:
PruneReason::NoErrorBoundForQueryTarget.NoValidCandidate, not as a solver error.MemoSteps::pass1_pruned_candidates. They lost it in test: area B tests pass on the stage-boundaries branch; fix decoded-output validation (plan-selection, planner) #1110.How
Composition uses
asap-accuracy's existing propagation. Each check is per query; a summary is pruned only when it fails for all of them.Key code interfaces added / modified
PruneReason::NoErrorBoundForQueryTargetAccuracyModel::metric_can_meet(metric, target) -> bool, with a default method&dyn AccuracyModelUsage: with
stage_pipeline --enforce-accuracy-guarantees, example 1's Q2 heap top-k candidates appear underpruned_candidateswith reasonno_error_bound_for_query_target.Major algorithm changes
Pass 1 now prunes structurally unboundable summaries.
Before / After
With guarantees enforced:
Verification
clippy --workspace --all-targets -D warnings: cleanNew unit tests:
🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bqhAk7WA4MZcfbAoMw