Skip to main content

Module sort

Module sort 

Source
Expand description

Sort/merge helpers for ORDER BY / LIMIT on generated IDB output.

Used by both binary mode (drain → sort → write file) and library mode (drain → sort → populate BatchResults). Pure algorithms over user-supplied comparators — no allocation beyond the inputs.

Functions§

k_way_merge
Stream a k-way merge of pre-sorted per-worker buffers into sink.
topk
Return the top-k of rows by cmp, fully sorted.