pitrou opened a new issue, #45190:
URL: https://github.com/apache/arrow/issues/45190

   ### Describe the enhancement requested
   
   Arrow C++ already offers a `rank` function: 
https://arrow.apache.org/docs/cpp/compute.html#sorts-and-partitions
   
   It would be useful to add a percentile rank function according to this 
definition: https://en.wikipedia.org/wiki/Percentile_rank
   
   Proposed API:
   ```c++
   /// \brief Percentile rank options
   class ARROW_EXPORT PercentileRankOptions : public FunctionOptions {
    public:
     explicit PercentileRankOptions(std::vector<SortKey> sort_keys = {},
                                    NullPlacement null_placement = 
NullPlacement::AtEnd,
                                    double factor = 1.0);
     /// Convenience constructor for array inputs
     explicit PercentileRankOptions(SortOrder order,
                                    NullPlacement null_placement = 
NullPlacement::AtEnd,
                                    double factor = 1.0)
         : PercentileRankOptions({SortKey("", order)}, null_placement, factor) 
{}
   
     static constexpr char const kTypeName[] = "PercentileRankOptions";
     static PercentileRankOptions Defaults() { return PercentileRankOptions(); }
   
     /// Column key(s) to order by and how to order by these sort keys.
     std::vector<SortKey> sort_keys;
     /// Whether nulls and NaNs are placed at the start or at the end
     NullPlacement null_placement;
     /// Factor to apply to the output.
     /// Use 1.0 for results in (0, 1), 100.0 for percentages, etc.
     double factor;
   };
   ```
   
   
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to