Repository navigation
Conversation
zzylol
changed the base branch from
stack/509-w7b-sql-frequency
to
stack/509-x1-stage1-tumbling
October 4, 2026 19:01
zzylol
force-pushed
the
stack/509-x8a-hydra-kernel
branch
from
October 4, 2026 19:01
9af256d to
09fa09e
Compare
zzylol
added a commit
that referenced
this pull request
Oct 4, 2026
A count with `by` groups and an approximate target gets one more alternative (#580 W7): one shared Count-Min grid for every group, as the SummaryAgg contract of #600 states. The update is a unit weight per row, hashed by a non-null Utf8/Int64/Bool column (a grouping column first, else the PromQL series identity). Grouping is a new per-alternative axis on LocalLogicalTarget, carried through tumbling forms. Stage 3's analytical guarantee is now grouping-aware: for HydraCms it is pass1::grouping::hydra_guarantee over the inner Count-Min, with collision term e/shared_columns and failure probability e^-shared_rows (relative to the whole input's weight). Pass 1 sizes the inner sketch and the grid for ε/2 and δ/2 each so the sum meets the target. Other shared groupings have no model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One shared grid of Count-Min cells serves every group (#580 item F, W7). Reads a group's total (min over rows of the cell's mass) and an item's frequency within a group (Hydra's median). Merge adds cells and is the grid of the union. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SummaryAgg with SharedMultiSubpopulation { kind: HydraCms } now compiles to
a shared summary build that emits one row per group over one grid, and
SummaryEstimate answers PointCount per group (bare: group count; valued:
item frequency). family_merges admits linear Hydra grids (CMS and
Count-Sketch cells) and rejects HydraKll.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
stack/509-x8a-hydra-kernel
branch
from
October 5, 2026 06:21
09fa09e to
f97037a
Compare
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.
Rebased on main d4869a7 (DF 54).
Why
#580 item F / W7: Hydra for count and point queries first. The types already model
GroupingStrategy::SharedMultiSubpopulation { kind: HydraCms, .. }, but the executor rejected every shared grouping. Its only Hydra kernel was HydraKLL, which automatic search never emits. Part of #509.What
Before this PR: a
SummaryAggwith HydraCms grouping failed at binding (invalid Count-Min dimensions or grouping strategy, orkeyed summary weight must be a finalized value column).family_mergesignored grouping, so HydraKll merges type-checked even though they have no accuracy model.After this PR:
count by (job)andcount of service="checkout" by (job)run against one shared grid, not one CMS per job:Each estimate is at least the exact value and within
e·N·(1/shared_columns + 1/width)of it. Two builds over a split stream, merged withSummaryMerge, return the same answers as one build over the whole stream.How
summary_kernels/hydra_cms.rsreusesasap_sketchlib::Hydra, whose cells areHydraCounter::CM, with a one-column schema: the whole group tuple is one subpopulation, so rows do not fan out to sub-groupings. Readouts:HydraCmsGroupis the row state: anArcto the shared grid, plus the group it reads.create_hydra_cms(family).create_planner_accumulatorstill rejects shared grouping, because it builds one state per group.SharedSummaryBuild, plus the planner branch inbind_operation.family_mergesis now grouping-aware.i32::MAX, the limit of sketchlib'si32counters.tests/hydra_cms_execution.rsfailed 2 of 3 (the binding errors above). After it, they pass.Planner contract (for the later Pass 1/Stage 1 PR; not emitted yet)
Output rows:
[group columns…, state], one per group.default_hydra_paramsalready gives this shape from a per-groupSketchParams::Cms.Not in this PR
SummaryMergealso merges the grid once per group.Gates
cargo fmt --all --check: passes.cargo clippy --workspace --all-targets --all-features -- -D warnings: passes.cargo test --workspace: 1,590 passed, 7 ignored. feat(executor): execute the exact SQL entropy fallback; Example 2 status #599 had 1,580 / 7; this PR adds 10 tests.🤖 Generated with Claude Code