mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
change percentile value ranges from 0-1 to 0-100
This commit is contained in:
parent
1228c6e188
commit
40e3acc3e4
2 changed files with 4 additions and 4 deletions
|
|
@ -1306,8 +1306,8 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string
|
|||
var nth float64
|
||||
if nthArg, ok := c.Args["nth"].(pql.Decimal); ok {
|
||||
nth = nthArg.Float64()
|
||||
if nth < 0 || nth > 1.0 {
|
||||
return ValCount{}, errors.Errorf("Percentile(): invalid nth value(%f), should be >= 0 and <= 1.0", nth)
|
||||
if nth < 0 || nth > 100.0 {
|
||||
return ValCount{}, errors.Errorf("Percentile(): invalid nth value(%f), should be >= 0 and <= 100", nth)
|
||||
}
|
||||
} else {
|
||||
return ValCount{}, errors.New("Percentile(): nth required")
|
||||
|
|
|
|||
|
|
@ -7053,7 +7053,7 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
|
|||
if nth == 0.0 {
|
||||
return min
|
||||
}
|
||||
k := (1 - nth) / nth
|
||||
k := (100 - nth) / nth
|
||||
|
||||
possibleNthVal := int64(0)
|
||||
// bin search
|
||||
|
|
@ -7127,7 +7127,7 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
|
|||
}
|
||||
|
||||
// generate test cases per each nth argument
|
||||
nths := []float64{0.0, 0.1, 0.25, 0.5, 0.75, 0.9, 0.99}
|
||||
nths := []float64{0.0, 10, 25, 50, 75, 90, 99.99}
|
||||
var tests []testCase
|
||||
for _, nth := range nths {
|
||||
query := fmt.Sprintf(`Percentile(field="net_worth", filter=Row(val="foo"), nth=%f)`, nth)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue