GH-50247: Reuse abstraction for null partitions in sorting functions
Rationale for this change
@pitrou mentioned this as a follow-up in #46926
What changes are included in this PR?
Refactoring sorting methods to reuse the helper methods avoid maintaining two abstractions for null partitions. The new abstraction was very seamless to implement in most cases, but a few spots required some care
In particular, these functions were severly simlpified by the new abstraction:
MarkDuplicates: duplicate nulls and nans were detected by checking every single row forNullone additional time, after we already had (and discarded) the nullness informationGenericMergeImpl: merging ofnull-ranges involved repartitioningnullandnanvalues in every merge invocation. Now, we track this distinction and do not need any merge function fornullandnanblocks
Are these changes tested?
Yes, the compute test suite passes as before
Are there any user-facing changes?
No.
- GitHub Issue: #50247
:warning: GitHub issue #50247 has been automatically assigned in GitHub to PR creator.
Hmm, there are some regressions in the test suite (see CI runs).
Also this runtime assertion on Windows CI might give a clue:
27/98 Test #49: arrow-compute-vector-sort-test ...............Exit code 0xc0000409
***Exception: 0.43 sec
[==========] Running 284 tests from 130 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from TestNthToIndicesForReal/0, where TypeParam = arrow::FloatType
[ RUN ] TestNthToIndicesForReal/0.NthToIndicesDoesNotProvideDefaultOptions
[ OK ] TestNthToIndicesForReal/0.NthToIndicesDoesNotProvideDefaultOptions (1 ms)
[ RUN ] TestNthToIndicesForReal/0.Real
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\span(160) : Assertion failed: cannot compare incompatible span iterators
Thank you for the comments. I returned from vacation and fixed the windows errors. I also added some short-hands to the struct so we have less boilerplate in getting the begin/end pointers of the partition ranges.