You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(arrow-ord): Avoid full index materialization for small-limit lexsorts #9990
As a result, bounded lexsorts still allocate and initialize indices for rows outside the returned prefix.
Current Behavior
For bounded lexsorts:
all rows
-> allocate and initialize one index per row
-> sort only the requested prefix
-> return the requested prefix
This is correct, but it does unnecessary index allocation for small limits.
Implications
Small-limit lexsorts spend time and memory creating indices that cannot appear in the returned result unless they are selected into the requested prefix.
This adds avoidable work for cases such as:
lexsort ... limit 10
lexsort ... limit 100
where the requested output is much smaller than the input.
Proposed Solution
For sufficiently small limits, maintain only the current top-k row indices while scanning the input, instead of first materializing every row index.
The existing partial-sort path should remain in use for larger limits, where maintaining a bounded heap is not beneficial.
Activity
perf(arrow-ord): Avoid full index materialization for small-limit lex…
alamb commentedon Jul 2, 2026
label_issue.pyautomatically added labels {'arrow'} from #9991