mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
Make percentile checker in test-case match executor implementation
This commit is contained in:
parent
af83205032
commit
b1d18a1ba3
2 changed files with 2 additions and 1 deletions
|
|
@ -1298,6 +1298,7 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string
|
|||
// compute average without integer overflow, then correct for division of
|
||||
// odd numbers by 2
|
||||
possibleNthVal := ((max / 2) + (min / 2)) + (((max % 2) + (min % 2)) / 2)
|
||||
// possibleNthVal = (max + min) / 2
|
||||
// get left count
|
||||
rangeCall.Args[fieldName] = &pql.Condition{
|
||||
Op: pql.Token(pql.LT),
|
||||
|
|
|
|||
|
|
@ -6939,7 +6939,7 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
|
|||
possibleNthVal := int64(0)
|
||||
// bin search
|
||||
for min < max {
|
||||
possibleNthVal = (max + min) / 2
|
||||
possibleNthVal = ((max / 2) + (min / 2)) + (((max % 2) + (min % 2)) / 2)
|
||||
leftCount, rightCount := int64(0), int64(0)
|
||||
for _, num := range nums {
|
||||
if num < possibleNthVal {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue