pitrou commented on code in PR #50297:
URL: https://github.com/apache/arrow/pull/50297#discussion_r3497269063


##########
cpp/src/arrow/compute/kernels/vector_select_k.cc:
##########
@@ -118,22 +117,22 @@ void HeapSortNonNullsToOutput(std::span<uint64_t> 
non_null_input_range, Comparat
     return;
   }
   std::span<uint64_t> heap = non_null_input_range.subspan(0, 
output_range.size());
-  std::ranges::make_heap(heap, cmp);
+  std::make_heap(heap.begin(), heap.end(), cmp);
 
   std::span<uint64_t> remaining_input = 
non_null_input_range.subspan(output_range.size());
   for (uint64_t x_index : remaining_input) {
     if (cmp(x_index, heap.front())) {
-      std::ranges::pop_heap(heap, cmp);
+      std::pop_heap(heap.begin(), heap.end(), cmp);
       heap.back() = x_index;
-      std::ranges::push_heap(heap, cmp);
+      std::push_heap(heap.begin(), heap.end(), cmp);
     }
   }
 
   // fill output in reverse when destructing,
   // as the "worst" (next-to-would-have-been-replaced) element is at heap-top
-  for (auto& reverse_out_iter : std::ranges::reverse_view(output_range)) {
-    reverse_out_iter = heap.front();  // heap-top has the next element
-    std::ranges::pop_heap(heap, cmp);
+  for (int64_t i = output_range.size() - 1; i >= 0; --i) {

Review Comment:
   Copilot didn't notice, but this has the same problem as below.



-- 
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]

Reply via email to