Repository navigation
Commit d3afe8e
feat(asap-aware-mapping): implement CSE stage 4 (Volcano/Cascades cost-based sharing)
Replaces the previous doc-comment-only decision for #237 with a real,
working implementation, per review feedback:
- The design discussion moves out of code comments into
docs/cse-cost-model-decision.md.
- CostModel gains CseCandidate/ShareDecision/cse_share_decision, plus
two overridable cost-estimation hooks (cse_recompute_cost,
cse_shared_maintenance_cost) with concrete default heuristics. The
default cse_share_decision body performs a genuine Volcano/Cascades-
style cost comparison — share iff the estimated cost of maintaining
one shared summary is no greater than the estimated total cost of
recomputing it independently at every consumer — rather than a fixed
System R-style rule.
- bind::implement_workload_with now computes each shared subtree's true
consumer_count via a whole-workload pre-pass, decides ShareDecision
once per shared subtree (from full knowledge of the workload's
sharing structure), and applies it consistently to every occurrence.
This closes out #223's stage 4 and #212's original "add CSE" tracking
issue. Stage 3 (structural-hash unification) landed separately in #244.
New tests: cost_model.rs unit tests pinning the default cost
comparison's behavior in both directions and confirming custom
CostModel overrides are actually consulted; a bind.rs test confirming
a CostModel that declines sharing produces genuinely independent
SummaryNodes even for two roots that are the same Rc<QueryExpr>. All
pre-existing CSE tests (including the DefaultCostModel-sharing
integration tests) still pass unchanged — the default cost weights
were calibrated against a real lowered query so today's sharing
behavior for realistic subtrees is preserved.
Verified: cargo build --workspace --all-targets, cargo test --workspace,
cargo fmt --all -- --check, cargo clippy --workspace --all-targets
--all-features -- -D warnings, cargo doc --workspace --no-deps (no new
broken-link warnings).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 227bad0 commit d3afe8e
4 files changed
Lines changed: 480 additions & 167 deletions
File tree
- crates
- asap-aware-mapping/src
- types/src/pre_asap
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
114 | 126 | | |
115 | 127 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
120 | 133 | | |
121 | 134 | | |
122 | 135 | | |
123 | 136 | | |
124 | 137 | | |
125 | 138 | | |
126 | | - | |
127 | | - | |
| 139 | + | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
133 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
138 | 157 | | |
139 | 158 | | |
140 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
141 | 163 | | |
142 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
143 | 178 | | |
144 | 179 | | |
145 | 180 | | |
| |||
866 | 901 | | |
867 | 902 | | |
868 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
869 | 943 | | |
0 commit comments