Describe the bug
Found by @Dandandan and @isidentical while testing the arrow 26.0.0 upgrade in DataFusion
apache/datafusion#4039 (comment)
To Reproduce
Run lexsort_to_indices with a limit on a multi-column sort.
Expected behavior
Additional context
quoting @isidentical:
Probably due to the changes in #2929, where we previously created an array of (&value_indices)[0..len] but now just create it from value_indices directly without any limit (the single-column case is handled separately; and it still respects the limit).
@tustvold authored the PR in question and I approved them so I feel responsible for fixing this