Part of #33.
What
A ReplacementStrategy detecting the catalog's "Roll-ups" primitive plus Peilin's "CSE across aggregations, and group by key management": when two Aggregate nodes share the same source subtree (same Rc child, post-CSE) with mergeable intents (agg_is_mergeable) and one's by set is a superset of the other's, the coarser aggregate can be produced by re-aggregating the finer one's output instead of an independent pass over the shared source.
Design
- Only fires for
agg_is_mergeable intents (Sum/Count/MinMax/Rate/Increase) — Avg/StdDev/Variance need the semantic-rewrite sub-issue's decomposition first, which the search composes automatically once both strategies are registered.
- Legality reuses
Schema::unique_keys the same way CSE's own sharing gate does — no new legality machinery, just a new matching relation (subset-of, not equality-of) layered on top.
ColumnId comparability across the two Aggregate nodes is only sound because they share the literal same child Rc (guaranteed identical positional numbering) — extending this to two structurally-different-but-equivalent sources is explicitly out of scope here.
- Interacts with the
GroupingStrategy/Hydra sub-issue: whether a SharedMultiSubpopulation structure can serve as the "finer" side of a roll-up depends on whether that summary family supports merging down to a coarser grouping — this issue should land the legality predicate as an explicit, testable function so that sub-issue can call it rather than assuming all combinations are valid.
Non-goal
Actually materializing a roll-up operator (a pre-aggregated Source/Scan leaf) at execution time is separate, larger work outside asap-aware-mapping's scope — this issue only needs the search to be able to construct the ReplacementSubDAG at the pre-ASAP level (child = the other aggregate's node instead of the raw scan).
Part of #33.
What
A
ReplacementStrategydetecting the catalog's "Roll-ups" primitive plus Peilin's "CSE across aggregations, and group by key management": when twoAggregatenodes share the same source subtree (sameRcchild, post-CSE) with mergeable intents (agg_is_mergeable) and one'sbyset is a superset of the other's, the coarser aggregate can be produced by re-aggregating the finer one's output instead of an independent pass over the shared source.Design
agg_is_mergeableintents (Sum/Count/MinMax/Rate/Increase) —Avg/StdDev/Varianceneed the semantic-rewrite sub-issue's decomposition first, which the search composes automatically once both strategies are registered.Schema::unique_keysthe same way CSE's own sharing gate does — no new legality machinery, just a new matching relation (subset-of, not equality-of) layered on top.ColumnIdcomparability across the twoAggregatenodes is only sound because they share the literal same childRc(guaranteed identical positional numbering) — extending this to two structurally-different-but-equivalent sources is explicitly out of scope here.GroupingStrategy/Hydra sub-issue: whether aSharedMultiSubpopulationstructure can serve as the "finer" side of a roll-up depends on whether that summary family supports merging down to a coarser grouping — this issue should land the legality predicate as an explicit, testable function so that sub-issue can call it rather than assuming all combinations are valid.Non-goal
Actually materializing a roll-up operator (a pre-aggregated
Source/Scanleaf) at execution time is separate, larger work outsideasap-aware-mapping's scope — this issue only needs the search to be able to construct theReplacementSubDAGat the pre-ASAP level (child = the other aggregate's node instead of the raw scan).