Skip to content

Cosmos: Support aggregate operators #16146

Closed
Closed

Description

@smitpatel

Average/Sum/Min/Max/Count

 typeof(Microsoft.Azure.Cosmos.QueryPlanHandler+QueryPlanHandlerException): Query contains 1 or more unsupported features. Upgrade your SDK to a version that does support the requested features:
    Query contained CompositeAggregate, which the calling client does not support. (Query contained CompositeAggregate, which the calling client does not support.)
    ---- Microsoft.Azure.Cosmos.QueryPlanHandler+QueryPlanHandlerException : Query contains 1 or more unsupported features. Upgrade your SDK to a version that does support the requested features:
    Query contained CompositeAggregate, which the calling client does not support. (Query contained CompositeAggregate, which the calling client does not support.)
    -------- System.ArgumentException : Query contained CompositeAggregate, which the calling client does not support.

Activity

  1. modified the milestones: 3.0.0, Backlog on Jun 20, 2019
  2. changed the title [-]Cosmos: Aggregate operators[/-] [+]Cosmos: Support aggregate operators[/+] on Jun 20, 2019
  3. JonPSmith commented on Oct 17, 2019

    @JonPSmith

    I'm trying to use Cosmos DB and I need a count of all the entries to make paging work. Can you suggest a way around this problem that doesn't require me to ingest all the data?

  4. AndriySvyryd commented on Oct 17, 2019

    @AndriySvyryd
    Member

    @JonPSmith The best you can do for now is something like
    query.Select(_ => 1).AsEnumerable().Count()

  5. 23 remaining items

  6. added this to the Backlog milestone on Jul 7, 2022
  7. removed their assignment
    on Sep 14, 2022
  8. roji commented on Jun 15, 2024

    @roji
    Member

    This is now supported, as of #33895 - though we're likely missing qiute a bit of test coverage.

    For example:

    await context.Set<OwnedPerson>().Select(o => o.Orders.Max(o => o.Id)).ToListAsync()

    ... now gets translated to:

    SELECT (
        SELECT VALUE MAX(t["Id"])
        FROM t IN c["Orders"]) AS c
    FROM root c
    WHERE c["Discriminator"] IN ("OwnedPerson", "Branch", "LeafB", "LeafA")

    Aggregate operators work also on the top-level entity types. GroupBy isn't yet supported, that's tracked by #17313.

  9. self-assigned this
    on Jun 15, 2024
  10. modified the milestones: Backlog, 9.0.0 on Jun 15, 2024
  11. modified the milestones: 9.0.0, on Jun 21, 2024
  12. modified the milestones: , 9.0.0 on Oct 12, 2024
  13. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions