felipecrv commented on code in PR #44394:
URL: https://github.com/apache/arrow/pull/44394#discussion_r1824547639
##########
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:
Another name suggestion: `stop_index` instead of `n`. That would also reduce
the weirdness around passing a negative `output_length` (lenghts can't be
negative), but a negative `stop_index` makes sense.
--
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]