Conversation
zzylol
force-pushed
the
refactor/sketch-kind-algorithm-nesting
branch
from
August 23, 2026 19:57
7ed5345 to
e609c86
Compare
zzylol
force-pushed
the
feat/replacement-strategy-251
branch
from
August 23, 2026 19:59
ca60c0c to
66c772d
Compare
zzylol
force-pushed
the
refactor/sketch-kind-algorithm-nesting
branch
5 times, most recently
from
August 24, 2026 02:47
fa72c44 to
e1a9296
Compare
…thm (SketchAlgorithm) Rebuilt on top of feat/replacement-strategy-251's latest tip (the bind::implement_tree/_with deletion). Same split as before: SketchKind becomes a nested category type (Quantile/Cardinality/Frequency/TopK, each wrapping a committed (SketchAlgorithm, SketchParams) pair) with SketchAlgorithm holding the old flat variant list (Kll/Cms/Hll/ DDSketch/CmsWithHeap/Kmv/Theta/CountSketch/CountSketchWithHeap). SketchKind::new(algorithm, params) is the one classifier; .algorithm()/ .params() extract the committed pair back out. SketchFamilyStrategy renamed to SketchAlgorithmStrategy throughout, to free up "family" to mean what SummaryFamilyType names (Sketch/Sample/ Wavelet/StatModel/ExactAggregate) and "kind" to mean the new sub-family category, keeping "algorithm" for the concrete realization. Implementation::Sketch and SummaryFamilyType::Sketch both collapse from a (kind, params) pair to a single SketchKind field, since a SketchKind already carries its own committed (algorithm, params). Reapplied by hand against the current tree rather than via rebase/ cherry-pick (a prior rebase across these same overlapping renames silently dropped hunks without conflict markers) — guided by `git diff` against the previous build of this branch to find every site, then verified end to end. Verified: cargo build --workspace --all-targets, cargo test --workspace (0 failures), cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings — all clean.
zzylol
force-pushed
the
refactor/sketch-kind-algorithm-nesting
branch
from
August 24, 2026 12:47
e1a9296 to
583112d
Compare
…diom A reader asked what the diagram's "a caller wanting one answer: replacements(...).into_iter().next()" line actually does — spell it out inline instead of assuming it's self-evident.
zzylol
added a commit
that referenced
this pull request
Aug 24, 2026
…thm (SketchAlgorithm) (#266, part of #33) Absorbs PR #266 (refactor/sketch-kind-algorithm-nesting) into this branch — #266 was last rebased on a much older tip and this branch's own code has since changed enormously (implementation.rs/bind.rs merged into replacement.rs, SummaryExpr::Logical -> KeepPreAsap, search.rs/PlanSpace merged in, bind.rs deleted), so #266's diff was read and manually reapplied against the current surface rather than merged/rebased/cherry-picked. Restructures the sketch type system into a real three-level nesting — family -> kind -> algorithm — instead of a flat (algorithm, params) pair: SummaryFamilyType::Sketch(SketchKind) SketchKind::Quantile(SketchAlgorithm, SketchParams) // + Cardinality/Frequency/TopK Implementation::Sketch(SketchKind) // mirrors SummaryFamilyType's shape - `SketchAlgorithm` — the old flat `SketchKind` enum (Kll/Cms/Hll/DDSketch/ CmsWithHeap/Kmv/Theta/CountSketch/CountSketchWithHeap), renamed verbatim — the actual concrete algorithm choice. - `SketchKind` — new nested enum (Quantile/Cardinality/Frequency/TopK), each variant carrying the committed `(SketchAlgorithm, SketchParams)` pair — a `SketchKind` value always already names which concrete algorithm, never "some quantile sketch, algorithm TBD". `SketchKind::new(algorithm, params)` is the one place a pair gets classified into its category; `.algorithm()`/ `.params()` extract the pair back out regardless of variant. - `SummaryFamilyType::Sketch(SketchKind, SketchParams)` collapses to `Sketch(SketchKind)`; `Implementation::Sketch { kind, params }` becomes the tuple variant `Sketch(SketchKind)`. - `SketchFamilyStrategy` -> `SketchAlgorithmStrategy` — it only ever enumerates algorithms within an already-fixed family+kind, never chooses between families/kinds (unbuilt future work, no ReplacementStrategy does that yet). `ForceSketchKind` no longer exists on this branch (already deleted during this session's earlier ReplacementStrategy/binding-unification work), so its rename to `ForceSketchAlgorithm` doesn't apply. - `CostModel::rank_candidates`/`size_params` now take/return `SketchAlgorithm` (they operate one level below `SketchKind`, on the concrete algorithm choice within an already-fixed kind); `sketch_kind_of` (the PlanSpace ranking helper added when search.rs merged into replacement.rs) likewise extracts `.algorithm()` for `CostModel::rank_candidates` comparisons. Updated every construction/destructuring site across `replacement.rs`, `cost_model.rs`, `lib.rs`, `crates/devtools`, `crates/frontend-promql`'s observability corpus test, and `crates/integration-tests`' l4_binding(_sql) and cse tests — not just `asap-aware-mapping`, per #266's own scope but against the current, much larger merged surface. Dev guide gets the "Family, kind, and algorithm" section from #266 plus the same family/kind/algorithm terminology pass across the rest of the guide and the user guide. Verified: cargo build/test/fmt/clippy --workspace all clean. PR #266 (refactor/sketch-kind-algorithm-nesting) is now superseded by this commit and should be closed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Superseded — its content (SketchKind/SketchAlgorithm nesting) was folded directly into #259 (feat/replacement-strategy-251) rather than staying a separate stacked PR. |
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.
Split out of #259 per zzylol's review comment on
replacement.rs:275— this is a genuinely separate concern (type-system restructuring) from #259'sReplacementStrategy/TargetSubDAGwork, so it's its own PR, stacked on top of #259 (base branch isfeat/replacement-strategy-251, notmain— merge #259 first).What
Aligns the type system to a real three-level nested structure — family → kind → algorithm — instead of a flat
(algorithm, params)pair onSummaryFamilyType::Sketch:SummaryFamilyType(family) — unchanged:Sketch,Sample,Wavelet,StatModel,ExactAggregate.SketchKind(kind) — new:Quantile/Cardinality/Frequency/TopK, each variant carrying the committed(SketchAlgorithm, SketchParams)— aSketchKindvalue is never just "some quantile sketch," it always already names which one.SketchAlgorithm(algorithm) — renamed from the old flatSketchKind:Kll/DDSketch/Hll/etc.SketchKind::new(algorithm, params)is the one place(SketchAlgorithm, SketchParams)gets classified into the right variant;.algorithm()/.params()get the pair back out regardless of variant.SketchFamilyStrategy→SketchAlgorithmStrategy,ForceSketchKind→ForceSketchAlgorithm— it only ever enumerates algorithms within an already-fixed family+kind, never chooses between families (that's unbuilt future work, noReplacementStrategydoes it yet).Also
Implementation::Sketchrestructured the same way, which simplifiesbind.rs'sImplementation -> SummaryFamilyTypeconversion for the sketch case to a straight pass-through instead of destructuring and rebuilding a pair.Updated every construction/destructuring site across
asap-aware-mappingandintegration-tests, plus the dev guide's family/kind/algorithm section.Checks
cargo build/test/fmt/clippy --workspaceall pass clean;cargo docintroduces no new broken-link warnings.🤖 Generated with Claude Code