WillAyd commented on code in PR #12963:
URL: https://github.com/apache/arrow/pull/12963#discussion_r861916605
##########
cpp/src/arrow/compute/kernels/vector_sort.cc:
##########
@@ -1909,6 +1909,120 @@ class SelectKUnstableMetaFunction : public MetaFunction
{
}
};
+// ----------------------------------------------------------------------
+// Rank implementation
+
+const RankOptions* GetDefaultRankOptions() {
+ static const auto kDefaultRankOptions = RankOptions::Defaults();
+ return &kDefaultRankOptions;
+}
+
+const FunctionDoc rank_doc(
+ "Returns the ranking of an array",
+ ("This function computes a rank of the input array.\n"
+ "By default, null values are considered greater than any other value
and\n"
+ "are therefore sorted at the end of the input. For floating-point
types,\n"
+ "NaNs are considered greater than any other non-null value, but smaller\n"
+ "than null values. The default tiebreaker is to assign ranks in order
of\n"
+ "when ties appear in the input\n"
+ "\n"
+ "The handling of nulls, NaNs and tiebreakers can be changed in
RankOptions."),
+ {"input"}, "RankOptions");
+
+class RankMetaFunction : public MetaFunction {
+ public:
+ RankMetaFunction()
Review Comment:
I was following the pattern set by SortIndices and keeping open the
possibility for more than just array implementations in the future, but happy
to just make RankFunction for now if you think that is cleaner
--
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]