Repository navigation
Description
Delivered in v3.0.0 development
The approved #641 plan was delivered in three dependent core PRs: #778 (snapshot-bound input-order proof and safe Sort omission), #779 (one-group built-in count/count-distinct), and #780 (partition-at-a-time built-in windows). Companion docs PRs are #80, #81, and #82. All six PRs are merged.
- A top-level plain query can omit a final Sort only when its pinned committed source proves the complete ascending result order for supported scalar kinds. Other access paths and order-changing operators keep Sort/top-k.
- A top-level plain grouped query can release one completed group at a time when it has exactly one proved scalar grouping key (integer, Boolean, canonical committed float, or mixed integer/float), no
:withor windows, no user callback orcollect-setanywhere in its pipeline, and only built-incount/count-distinct. Entity, keyword and string groups retain full-input evaluation. It holds the current group's state plus bounded batches; a single large distinct group can still grow. - Compatible built-in windows sharing one proved nonconstant partition key can release completed partitions. Unpartitioned, incompatible, callback,
collect-setand aggregate-query windows keep full-input evaluation.
The proofs use the query's pinned snapshot and reject pending/staged records in the relevant source range. DICT order can prove partition adjacency but does not replace semantic Sort or Aggregate order. Rule queries and nested not/or bodies are unchanged. Answers, aggregate data errors and callback behavior are preserved. As with other streaming operators, a cursor may receive rows before a later I/O/allocation error, and Limit may leave unread input unvalidated.
Follow-up boundary
Generalizing one-group Aggregate to other ordinary built-ins, Value::Ord-ordered composite keys and :with is tracked in #781; considering avg there depends on #777 adding ordinary avg first. Callback, collect-set, aggregate+window and rule-query fallbacks remain outside that optimization. This issue records the delivered, conservative optimization; it does not claim every grouped aggregate streams.
Background: deferred from #547 and part of #473's streaming-engine design. The index/value comparator distinction in the original issue remains a requirement for follow-up work.
Activity
Merge pull request #778 from project-minigraf/feat/641-input-order
Merge pull request #779 from project-minigraf/feat/641-grouped-aggregate
Merge pull request #780 from project-minigraf/feat/641-partition-window
[-]Streaming engine: skip Sort on index order, sort-grouped Aggregate[/-][+]perf(query): proved Sort omission, one-group count and partition windows[/+]adityamukho commentedon Oct 28, 2026
Closed after core PRs #778, #779 and #780 and docs PRs project-minigraf/minigraf-docs#80, #81 and #82 merged. The delivered scope is recorded above. Remaining ordered Aggregate generalization is tracked in #781; its ordinary avg portion depends on #777.