Azure / Azure/azure-sdk-for-rust
Support cross-partition aggregate queries
- Dominant language
- Rust
- Stars
- 884
- Forks
- 365
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 109
Description
### 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/`.
Contributor guide
Research direction
Start in sdk/cosmos/azure_data_cosmos_driver/src/driver/dataflow/ and read the parent issue's rewritten-query application, aggregate result envelopes, buffering limits, response transformation, and non-resumable continuation policy. Compare the .NET Aggregate pipeline stages and SingleGroupAggregator and the Java AggregateDocumentQueryExecutionContext and aggregation/ references. Done means production COUNT, SUM, MIN, MAX, and AVG execution with the listed edge cases and reusable dataflow tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, rust
- Domain
- cloud, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100