-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
Description
An interesting edge case that I found when working on #24330: It seems that percentiles_bucket relies on the percents parameter beeing specifies in increasing order or magnitude. If the list of percentiles to calculate is provided in a different order, e.g.
"percentiles_monthly_sales": {
"percentiles_bucket": {
"buckets_path": "sales_per_month>sales",
"percents": [ 50.0, 25.0, 75.0 ]
}
}
the following error is thrown:
"type": "illegal_argument_exception",
"reason": "Percent requested [50.0] was not one of the computed percentiles. Available keys are: [50.0, 25.0, 75.0]"
The reason seems to be that in InternalPercentileBucket#percentile(double percent) (
Line 75 in f217eb8
| int index = Arrays.binarySearch(percents, percent); |
I think we could either throw an error early if we think the percents need to be provided in order, re-sort the array if the user provided it unsorted or change the implementation of InternalPercentileBucket so it doesn't rely on an ordered array.