-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-45190: [C++][Compute] Add rank_quantile function #45259
base: main
Are you sure you want to change the base?
Conversation
@zanmato1984 @jorisvandenbossche Do you want to take a look at this? Naming-wise, I hesitated between "rank_percentile" and "percentile_rank". I chose the former for better tab-completion. |
Update 2: Oops, sorry I think my original question remains: if
, then shall we name it |
|
Hi @pitrou , I want to suggest a refinement that simplifies the code structure of your current pr. I think the best way to show it is via actual code changes, so may I open up a pr targeting your branch? Thanks. |
Yes, you can! |
af782d4
to
4fd918a
Compare
Seems the latest force push doesn't include the changes I've made. Anything wrong? :) |
Hmm, that's weird. I might have messed things up, let me take a look... |
4fd918a
to
880b7a5
Compare
Ok, this is fixed :) |
880b7a5
to
5cc6b50
Compare
5cc6b50
to
8c59c76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with two nits.
ARROW_SCOPED_TRACE("type = ", type->ToString()); | ||
AssertRankQuantileEmpty(type); | ||
|
||
// Reproduce the example from https://en.wikipedia.org/wiki/Quantile_rank |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Reproduce the example from https://en.wikipedia.org/wiki/Quantile_rank | |
// Reproduce the example from https://en.wikipedia.org/wiki/Percentile_rank |
AssertRankQuantile(SortOrder::Ascending, null_placement, 100.0, | ||
"[30.0, 80.0, 30.0, 80.0, 30.0]"); | ||
AssertRankQuantile(SortOrder::Descending, null_placement, 100.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want /*factor=*/100.0
for this as well as the following cases.
Rationale for this change
Add a "rank_quantile" function following the Wikipedia definition:
https://en.wikipedia.org/wiki/Percentile_rank
Are these changes tested?
Yes.
Are there any user-facing changes?
Yes, an additional compute function.