Skip to content

Support cross-partition aggregate queries #4749

Description

@tvaron3

Feature Summary

Add production cross-partition COUNT, SUM, MIN, MAX, and AVG query execution to the Cosmos DB Rust driver.

Feature Description

Merge Gateway rewritten aggregate payloads across partitions and produce the expected public query shape.

Validation and acceptance criteria:

  • Support COUNT, SUM, MIN, MAX, and AVG in production execution.
  • Merge AVG from its rewritten sum and count components rather than averaging partition averages.
  • Decode Gateway rewritten aggregate payloads and preserve SELECT VALUE versus aliased projection shapes.
  • Emit one terminal aggregate result page after all required partitions are drained.
  • Initially reject external continuation tokens explicitly.
  • Cover empty inputs, mixed values, null, undefined, numeric overflow, aliases, multiple aggregates, and partition splits.
  • Keep MAKE_LIST and MAKE_SET as explicit follow-up work pending cross-SDK parity confirmation.

Use Case

Applications need server-compatible aggregate results over all partitions without manually fan-out querying and combining partial values.

Alternatives

Application-side aggregation cannot reliably reproduce rewritten payload semantics, alias/value output shapes, diagnostics, split behavior, or Cosmos numeric handling.

Additional Context

Implement under sdk/cosmos/azure_data_cosmos_driver/src/driver/dataflow/. This depends on the parent issue's rewritten-query application, aggregate result envelopes, buffering limits, response transformation, non-resumable continuation policy, and reusable dataflow tests. Cross-SDK references: .NET Aggregate pipeline stages, SingleGroupAggregator, accumulator files, and AggregateQueryTests; Java AggregateDocumentQueryExecutionContext, SingleGroupAggregator, and aggregation/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.CosmosThe azure_cosmos crate

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions