Skip to content

[Subtask]: Exploit proven grouping-key order with costed streaming aggregation #30859

Open

Description

@aunjgr

Parent Issue

#30838

Detail of Subtask

Evidence reassessment — 2026-10-26

Current delivery/performance status: ELIGIBILITY AND COST DIAGNOSIS FIRST; no ordered-input benefit is established for the captured TPC-H images.

Observed: Historical Q18 has 150M groups and about 8.66 GiB inner state. Complete grouping-key order could change the state algorithm, but existing partial hash-output streaming is not complete-group finalization. A primary key, generation order or object min/max metadata does not prove global parallel-reader output order.

Not yet established: An actually reachable input order with a cheaper complete plan than hash aggregation, including obtaining/merging that order.

Next discriminating experiment: Trace current physical-property propagation across objects/readers/exchanges and identify a real ordered case. Prove group continuity across batches and sources, then measure full acquisition/merge/finalization cost against hashing.

Measured target: Lower peak group state/work and query latency for a proven eligible workload; no unconditional Q18 or asymptotic-state claim.

Mandatory controls and total cost boundary: Unsorted/interleaved/overlapping sources, nullable/composite/collated keys, missing properties, groups crossing batches, low NDV, early stop/cancellation and backpressure.

Performance acceptance and rejection

  • Freeze current-main/candidate sources, executables, real caller shapes and effective settings. Use the unchanged qualification SQL and complete result consumption; exclude cold runs and keep profiles separate from latency scoring.
  • Demonstrate the named work/CPU reduction and an attributable uninstrumented target-query improvement. Include the controls below and full Q1-Q22 comparison; component wins, source changes, functional tests, SCA, merging and profile percentages are separate evidence.
  • A confirmed affected/control slowdown fails; unresolved slower signals are inconclusive. Confirm with an independent longer balanced run. No gain elsewhere, favorable average or self-approved tolerance waives a regression.
  • Complete applicable SF10/SF100 and memory/mixed-I/O acceptance before issue closure under the umbrella protocol. Report uncertainty, absolute CPU/instructions/work, allocations/copies and the same whole-application budget, effective cache, I/O/spill/swap/pressure evidence. Benchmark scripts do not verify input/table/schema/row counts/reference results/checksums.

Semantics and lifecycle requirements retained

  • A reviewed design demonstrates an actually reachable ordered case, sound physical-property propagation, exact group-boundary semantics, cost eligibility and deterministic hash fallback.
  • Focused UT/BVT cover groups crossing batches/objects, interleaved/overlapping source ranges, missing/invalid order properties, composite/NULL keys, equal-key merges and unsupported grouping sets.
  • Lifecycle tests preserve bounded pending input/output/state through backpressure, early stop, cancellation and reset/reuse; no unbounded buffering to manufacture order.
  • Measure complete plan costs including obtaining/merging order, peak group state, hash work avoided, CPU/instructions and uninstrumented latency at SF10/SF100. Include unsorted and low-cardinality controls.
  • Do not promise Q18 eligibility or reduced asymptotic state until the scan/merge order is proved. If actual order acquisition is cost-negative, record that result and retain the cheaper path.

Describe implementation you've considered

Reuse a bounded ordered path only with a sound complete-key order proof and hash fallback. If no eligible or cost-positive case exists, report that negative finding and rescope before implementation; do not add a full sort merely to lower hash-state statistics.

Coordination: #30847 hash baseline, #30841 key identity and #30852 critical path. Preserve existing partial streaming and aggregate functions.

Additional information

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added
    severity/s0
    on Oct 22, 2026
  3. assigned and unassigned on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/subtaskseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions