felipecrv commented on code in PR #44394:
URL: https://github.com/apache/arrow/pull/44394#discussion_r1824544446


##########
cpp/src/arrow/compute/api_vector.h:
##########
@@ -705,5 +736,56 @@ Result<std::shared_ptr<Array>> PairwiseDiff(const Array& 
array,
                                             bool check_overflow = false,
                                             ExecContext* ctx = NULLPTR);
 
+/// \brief Return the reverse indices of the given indices.
+///
+/// For indices[i] = x, reverse_indices[x] = i. And reverse_indices[x] = null 
if x does
+/// not appear in the input indices. For indices[i] = x where x < 0 or x >= 
output_length,
+/// it is ignored. If multiple indices point to the same value, the last one 
is used.
+///
+/// For example, with indices = [null, 0, 3, 2, 4, 1, 1], the reverse indices 
is
+///   [1, 6, 3]                    if output_length = 3,
+///   [1, 6, 3, 2, 4, null, null]  if output_length = 7.

Review Comment:
   Right, so could you call it `n` or `max_index` (i.e. `n - 1`) instead. The 
output length becomes a consequence of how far the loop goes. So at least to me 
it was easier to understand this parameter as a constraint on the loop and the 
output length being just a consequence of 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]

Reply via email to