Expected DISTINCT facts are assertions only.
Honest by construction
Expected DISTINCT facts are assertions only.
compiler is source of truth \text{compiler is source of truth} compiler is source of truth
Render checked rows
The guarded DISTINCT pipeline renders 3 output rows after recomputation.
checked rows = 3 \text{checked rows}=3 checked rows = 3
DISTINCT examples are tiny finite bag-to-table transforms; this model shows first-seen representatives for deterministic display and does not claim product SQL output ordering.
Honest by construction: bag input rows id city status 1 Austin open 2 Austin open 3 Boston closed 4 Austin closed 5 NULL open 6 NULL open
WHERE then SELECT projection source input whereTruth projectedRow distinctRole 0 [1, Austin, open] TRUE [Austin] representative 1 [2, Austin, open] TRUE [Austin] duplicate 2 [3, Boston, closed] TRUE [Boston] representative 3 [4, Austin, closed] TRUE [Austin] duplicate 4 [5, NULL, open] TRUE [NULL] representative 5 [6, NULL, open] TRUE [NULL] duplicate
DISTINCT groups key sources representativeSource duplicateCount [Austin] [0, 1, 3] 0 2 [Boston] [2] 2 0 [NULL] [4, 5] 4 1
DISTINCT output rows city Austin Boston NULL
DISTINCT facts fact value inputRowCount 6 whereKeptRows 6 whereDroppedRows 0 projectedRowCount 6 distinctRowCount 3 duplicateDropCount 3 nullKeyRows 2 selectColumnCount 1 representativeOrder first_seen_model_order_not_sql_order_claim
Try to tamper
Wrong expected facts, derived sidecars, missing columns, duplicate selected columns, bools, floats, and unsupported keys fail closed.
tamper rejected \text{tamper rejected} tamper rejected
Summary
The book shows exact finite DISTINCT behavior only; product SQL behavior is outside the model.
scoped DISTINCT model \text{scoped DISTINCT model} scoped DISTINCT model