nirandaperera commented on a change in pull request #10585:
URL: https://github.com/apache/arrow/pull/10585#discussion_r664587075
##########
File path: cpp/src/arrow/compute/kernels/vector_sort.cc
##########
@@ -477,6 +491,87 @@ class ArrayCountSorter {
}
};
+using ::arrow::internal::Bitmap;
+
+template <>
+class ArrayCountSorter<BooleanType> {
+ public:
+ ArrayCountSorter() = default;
+
+ // Returns where null starts.
+ uint64_t* Sort(uint64_t* indices_begin, uint64_t* indices_end,
+ const BooleanArray& values, int64_t offset,
+ const ArraySortOptions& options) {
+ // 32bit counter performs much better than 64bit one
+ if (values.length() < (1LL << 32)) {
+ return SortInternal<uint32_t>(indices_begin, indices_end, values,
offset, options);
+ } else {
+ return SortInternal<uint64_t>(indices_begin, indices_end, values,
offset, options);
+ }
+ }
+
+ private:
+ template <typename CounterType>
+ void CountBits(const BooleanArray& values, int64_t offset, CounterType*
set_count,
+ CounterType* null_count) {
Review comment:
Oh okay. I did this way because we can count both nulls and trues in a
single pass. But sure, I'll use that.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]