diff --git a/sql3/planner/oppqlaggregate.go b/sql3/planner/oppqlaggregate.go index 20b867660..b8938d4bf 100644 --- a/sql3/planner/oppqlaggregate.go +++ b/sql3/planner/oppqlaggregate.go @@ -230,17 +230,15 @@ func (i *pqlAggregateRowIter) Next(ctx context.Context) (types.Row, error) { return nil, sql3.NewErrInternalf("unexpected aggregate nth arg type '%T'", coercedNthValue) } - if cond == nil { - cond = &pql.Call{Name: "All"} - } - call = &pql.Call{ Name: "Percentile", Args: map[string]interface{}{ "field": expr.columnName, "nth": nth, }, - Children: []*pql.Call{cond}, + } + if cond != nil { + call.Args["filter"] = cond } default: