Hybrid measure sort on base types
Sort a CRUD / hybrid list by a Phase B measure (e.g. click Average on Model Bank :models). Not in MVP (Issue 12).
MVP: hybrids stay id-first Phase A + Phase B. :average-rating is visible and not sortable. 09 relaxes :sortable t without :column t for rollups only. :hot-models is last-30-days activity, not this list.
When this lands:
- Phase A still selects ids (plan 02). Same hydrate in Phase B.
ORDER BYis a scalar subquery (or grouped join) from 08b's mapper. Not a third shape. Not measure Phase A on the hybrid (:modelsneeds Phase B for images, scoped write-through rating, buttons).:totalstaysCOUNT(*)on the table. Unrated rows sort withNULLS LAST(AVG of zero facts is NULL).- Only
:avg/:sum/:count. Not:first/:list/:distinct.
Traps (do not close this door in 08b/09):
- Do not globalize 09's
:column trelaxation. Hybrid:sortable ton:average-ratingis a compile error until this item. - 08b's mapper returns the raw SQL agg. Rollup SELECT wraps
COALESCEfor:sum/:list/:distinct. ThisORDER BYuses the raw form plusNULLS LAST. Do not bake rollup zero-fact display into the mapping (ranking 0 while stars show empty). - The subquery reads the fact table directly. Do not replay the hybrid's view join (
:modelsjoins images and ratings; Lisp:avgcan double-count). Display fan-out is Issue 16's cousin, not a sort input. - No write-time denormalized
average_ratingcolumn. The compiler stays authoritative. - Do not Lisp-sort the whole table "for now." Do not treat a rollup as the sortable stand-in for the CRUD type.
Depends on 08b's mapper being callable without assuming GROUP BY.
- Slot
- 16100
- Status
- 10 Open
- Tags
- backend, compiler
- Contributors
- Donnie