lidavidm commented on a change in pull request #11132:
URL: https://github.com/apache/arrow/pull/11132#discussion_r706371043
##########
File path: cpp/src/arrow/compute/kernels/select_k_test.cc
##########
@@ -63,14 +63,9 @@ Result<std::shared_ptr<Array>> SelectK(const Datum& values,
int64_t k) {
}
}
-template <SortOrder order>
Result<std::shared_ptr<Array>> SelectK(const Datum& values,
Review comment:
At this point there is no need to keep SelectK here, we should just
remove it.
##########
File path: cpp/src/arrow/compute/api_vector.h
##########
@@ -292,19 +289,20 @@ ARROW_EXPORT
Result<std::shared_ptr<Array>> NthToIndices(const Array& values, int64_t n,
ExecContext* ctx = NULLPTR);
-/// \brief Returns the first k elements ordered by `options.keys`.
+/// \brief Returns the indices of the first k elements ordered by
`options.sort_keys`.
///
-/// Return a sorted array with its elements rearranged in such
+/// Select an array of indices of the sorted array with its elements
rearranged in such
/// a way that the value of the element in k-th position (options.k) is in the
position it
-/// would be in a sorted datum ordered by `options.keys`. Null like values
will be not
-/// part of the output. Output is not guaranteed to be stable.
+/// would be in a sorted datum ordered by `options.sort_keys`. Null like
values will be
+/// not part of the output. Output is not guaranteed to be stable.
Review comment:
I think this wording could probably be improved a little more, perhaps
something like (in line with the wording for SortIndices below)
```
Returns the indices that would select the first K elements of the array in
the specified order.
Perform an indirect sort of the datum, keeping only the first K elements.
The output array will
contain indices such that the item indicated by the k-th index will be in
the position it would be
if the datum were sorted by `options.sort_keys`. However, indices of null
values will not be
part of the output. The sort is not guaranteed to be stable.
```
--
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]