Expected group facts are assertions only; compiler output is the source of truth.

highlighted = computed this step

Honest by construction

Each lesson compiles raw rows and aggregate specs, turns recomputed facts into expected assertions, then compiles again.

expected is assertion only\text{expected is assertion only}

Show the guarded grouping

The guarded check has 3 groups and 2 aggregate specs.

groups=3\text{groups}=3

Grouping examples are tiny finite table transforms; SQL dialects, NULLs, AVG/rounding, planner behavior, indexes, performance, and product behavior are out of scope.

Guarded group facts: base rowssourceRowidkindqty01book212game123book334game445tool1 group by columnscolumnkind aggregate specsopcolumnascount_rowsrowsnsum_intqtytotal_qty group bucketskeysourceRowsrowCount[book][0, 2]2[game][1, 3]2[tool][4]1 aggregate rowskeyntotal_qty[book]25[game]25[tool]11 having keep/dropkeystatusreason[book]keepno_having[game]keepno_having[tool]keepno_having output rowskeyntotal_qty[book]25[game]25[tool]11 group factsfactvaluerowCount5groupByColumnCount1groupCount3aggregateCount2outputGroupCount3havingnonehiddenGroupsno

Try to tamper

Wrong expected facts, derived sidecars, duplicate columns, missing group columns, non-integer sums, and bad HAVING aliases fail closed.

fail closed before render\text{fail closed before render}

Summary

Book twenty-three stays inside finite GROUP BY, COUNT, SUM, and group filtering.

recomputed group facts\text{recomputed group facts}