Conversation
DAG assembly replaced any selected outer Sum over an inner aggregate with a query-time exact Sum, even when the selected summary realizes the inner Rate itself. The grouped Sum state therefore never reached the inventory, and no lifecycle choice could move grouped Sum into precompute. Assembly now keeps such a selected summary; the query-time residual still applies when the outer summary would hide its inner aggregate in KeepPreAsap. Default selection for sum by(job)(rate(...)) now yields Rate -> grouped Sum state; the physical frontier test reads its query root accordingly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SketchAlgorithmStrategy::fixed_window_rate_candidates and query_time_rate_aggregation_candidates returned the same logical DAG as the ordinary heap or grouped Sum candidate with Rate finalization flipped between ingestion and query time. Placement now comes only from a chosen lifecycle via SummaryMaintenanceLifecyclePlan::execution_timed_dag. compile_fixed_window_rate_aggregation takes that lifecycle-timed PostAsapDag instead of a SummaryNode with baked-in timing. The fixed-window heap test binds continuously maintained lifecycles; the grouped Sum placement pair is covered by the lifecycle end-to-end test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #482.
Why
The agreed layering says logical
PlanSpacedecides what to compute and achosen lifecycle assignment decides timing. Two logical-side sites still chose
placement for grouped Rate→Sum and Rate heap Top-K:
SketchAlgorithmStrategy::{fixed_window_rate_candidates, query_time_rate_aggregation_candidates}(feat: expose physical-ready logical candidates in Planner selection #472) returned the ordinary candidate with Rate finalization flipped between
ingestion and query time: timing-only duplicates.
query-time exact Sum, so the Sum state never reached the inventory. This is why
feat: derive execution timing from a summary lifecycle plan #482 found Candidate B (Sum in precompute) not expressible as a lifecycle
choice.
What
query-time residual (fix(sql): preserve nested temporal aggregates #372) still applies when the outer summary would hide the
inner aggregate in
KeepPreAsap.promql_rows::compile_fixed_window_rate_aggregationnow takes thelifecycle-timed
PostAsapDag.describe Candidates A/B as lifecycle choices.
Before this PR
After this PR
Default
global_selectionfor grouped Rate→Sum now returns the Sum-statecandidate instead of the query-time residual.
precompute_candidatesreads itsquery root (
assemble_selected_query) and finds the Rate readout by edge. Everyother fixture is unchanged.
Not in scope
MaintainPopulation):execution_timed_dagrefusesthem until lifecycle enumeration covers non-
SummaryAggstate.Explicit
compile_candidatesfrontiers can still persist per-series ratevalues.
incremental maintenance for rate-snapshot heaps/Sums. The comment states the
"no accumulation across evaluations" requirement.
Sumstate +Ephemeralgive the sameplacement through different operators. Both remain as logical alternatives.
Validation
grouped_rate_sum_inventory_keeps_sum_state_for_lifecycle_placement(unit) andgrouped_rate_sum_placement_is_a_lifecycle_choice(e2e, both placementscompiled to the expected precompute/query contents).
rate_candidate_inventories_have_no_timing_only_duplicates.maintained_rate_heap_lifecycle_compiles_fixed_window_precomputereplaces thefixed-window heap test and executes across the state boundary.
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --no-fail-fast: 1372 passed, 0 failed.🤖 Generated with Claude Code