Skip to content

Aggregate continued queries without an explicit group have incorrect results #3979

@hazefully

Description

@hazefully

For a query with an aggregate function and no explicit group such as SELECT COUNT(*) FROM T that ends up being planned as a RecordQueryStreamingAggregationPlan, partial aggregation results do not get stored in continuations correctly. As a result, the final result retrieved from the final continuation will not contain the partial results from previous executions.

For example, if T has 13 rows and no aggregate indexes defined, the query will be planned as SCAN(<,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0). If we assume an enforced scan row limit of 5, we expect the final result after 2 continuations to be 13, but instead the result is 1, which is the number of records scanned in the third scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions