Skip to content

post-asap: GroupingStrategy axis - PerSubpopulationInstance vs SharedMultiSubpopulation (Hydra) summary types #256

Description

@zzylol

Part of #33.

What

A new orthogonal axis on Implementation/SummaryFamilyType, alongside SketchKind/SamplingKind/WaveletKind/StatModelKind: how a grouped aggregate's summary state is physically instantiated across its by subpopulations.

/// Orthogonal to which summary family/kind is chosen — how many physical
/// instances of it exist across a grouped aggregate's subpopulations.
#[derive(Debug, Clone, PartialEq)]
pub enum GroupingStrategy {
    /// Today's only (implicit) behavior: one summary instance per distinct
    /// `by` key.
    PerSubpopulationInstance,
    /// One shared structure serving every subpopulation (Hydra and its
    /// per-family variants — HydraKLL, HydraCMS, HydraHLL, HydraUnivMon,
    /// per the existing `hydra_*` wrappers in this org's sketch-bench).
    SharedMultiSubpopulation { kind: HydraKind, params: HydraParams },
}

(Named SharedMultiSubpopulation, not SharedMultiTenant — this is sharing across the query's own subpopulations/group-by keys, not multi-tenant in the deployment-isolation sense.)

HydraKind/HydraParams mirror the existing per-family (Kind, Params) pattern (SketchKind/SketchParams, etc. in asap_types::post_asap).

Where it plugs in

  • Implementation::Sketch/Sample/Wavelet each grow a grouping: GroupingStrategy field (a breaking change to those variants — scoped as its own issue for exactly that reason, per the discussion on Add logic to detect which optimizations are applicable to a query workload #33).
  • Exposed as another ReplacementStrategy (see that sub-issue): candidates() only produces a SharedMultiSubpopulation alternative when by is non-empty (empty by has no subpopulation axis at all) and a Hydra variant exists for the chosen family.
  • Legality, not cost: whether Hydra is worth it for a given estimated subpopulation cardinality is a cost-model question (deployment-owned, out of scope here); whether it's valid at all (non-empty by, family has a Hydra variant) is what this issue's strategy must gate correctly, same split boundary::implementation_for already draws between "can this be built" and "should it be."
  • Must call the roll-up sub-issue's merge-legality predicate before offering a SharedMultiSubpopulation candidate as either side of a roll-up substitution, rather than assuming every combination composes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions