Commit 806aa7e
transform: add equality-saturation MIR optimizer (mz_transform::eqsat)
Introduce an equality-saturation optimizer that lowers a subset of
MirRelationExpr into an e-graph, applies confluent rewrite rules plus
congruence closure to a bounded fixpoint, and extracts the cheapest
equivalent plan under a two-axis (memory-first, time-second) cost model.
The pass registers in the logical and physical optimizers behind per-phase
feature flags, equivalence- and type-preserving at the live boundary
(adopt_if_type_preserving), with a MAX_PLAN_SIZE guard. It reuses the
production CanonicalizeMfp, Demand, and ProjectionPushdown machinery after
raise, and seeds index availability and literal-filter lookups from the
oracle in the physical phase.
Includes: the Rel IR with opaque bail, lower/raise round-trip, the saturation
engine with budgets and scope peeling for Let/LetRec, lattice e-class analyses
(NonNeg, Keys, Monotonic, Equivalences, ConstantColumns), greedy and ILP
extractors, extraction-time CSE, a build-time rule DSL with per-rule codegen,
a pluggable join orderer (DpSub default, Dpccp, DphypBushy), a Lean 4
soundness-spec emitter, and the architecture reference doc.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019m58NEHNTg4NQ2YuQmrpzQ1 parent 45a4691 commit 806aa7e
148 files changed
Lines changed: 29556 additions & 3130 deletions
File tree
- .superpowers/sdd
- ci/test/lint-main/checks
- docs/superpowers
- plans
- specs
- src
- catalog/src/builtin
- environmentd/tests/testdata/http
- repr/src
- sql/src
- plan/statement
- session/vars
- transform
- build
- examples
- lean
- MirRewrite
- src
- analysis
- eqsat
- rules
- tests
- test_transforms
- test
- sqllogictest
- advent-of-code/2023
- attributes
- autogenerated
- explain
- introspection
- postgres
- transform
- notice
- testdrive
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
| |||
363 | 364 | | |
364 | 365 | | |
365 | 366 | | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| |||
0 commit comments