pitrou commented on a change in pull request #8623:
URL: https://github.com/apache/arrow/pull/8623#discussion_r520605189
##########
File path: cpp/src/arrow/compute/kernels/vector_sort.cc
##########
@@ -30,6 +32,58 @@ namespace internal {
namespace {
+// NOTE: std::partition is usually faster than std::stable_partition.
+
+struct NonStablePartitioner {
+ template <typename Predicate>
+ uint64_t* operator()(uint64_t* indices_begin, uint64_t* indices_end,
Predicate&& pred) {
+ return std::partition(indices_begin, indices_end,
std::forward<Predicate>(pred));
+ }
+};
+
+struct StablePartitioner {
+ template <typename Predicate>
+ uint64_t* operator()(uint64_t* indices_begin, uint64_t* indices_end,
Predicate&& pred) {
+ return std::stable_partition(indices_begin, indices_end,
+ std::forward<Predicate>(pred));
+ }
+};
+
+// Move Nulls to end of array. Return where Null starts.
+template <typename ArrayType, typename Partitioner>
Review comment:
@bkietz Apparently one can't use a template function as template
argument. Is that right?
(I originally wanted to pass `std::partition` as a template function
argument)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]