correct k calculation and change test nth values

This commit is contained in:
Maxton Huff 2021-03-24 10:58:47 -05:00
parent 40e3acc3e4
commit d3438e8a80
2 changed files with 2 additions and 2 deletions

View file

@ -1365,7 +1365,7 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string
rangeCall = intersectCall.Children[0]
}
k := (1 - nth) / nth
k := (100 - nth) / nth
min, max := minVal.Val, maxVal.Val
// estimate nth val, eg median when nth=0.5

View file

@ -7127,7 +7127,7 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
}
// generate test cases per each nth argument
nths := []float64{0.0, 10, 25, 50, 75, 90, 99.99}
nths := []float64{0.0, 10, 25, 50, 75, 90, 99}
var tests []testCase
for _, nth := range nths {
query := fmt.Sprintf(`Percentile(field="net_worth", filter=Row(val="foo"), nth=%f)`, nth)