Skip to content

Introducing Standard Aggregation Method union #2114

@xtofs

Description

@xtofs

Analogous to existing standard aggregation methods in sections [3.2.1.3 Aggregation Methods] we introduce a union aggregation method that collects (aggregates) the values into a collection with no repeated values and a non-deterministic ordering.

The terminology is derived from the fact that this aggregation is a repeated union operation of representations of mathematical sets.

For example, given a nested collection of primitive types, with a schema like the following.

<EntityType Name="Product">
  <Key>
    <PropertyRef Name="ID"/>
  </Key>
  <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
  <Property Name="Name" Type="Edm.String"/>
  <Property Name="Color" Type="Edm.String"/>
  <Property Name="Tags" Type="Collection(Edm.String)"/>
</EntityType>

and

<EntitySet Name="Products" EntityType="Namespace.Product"/>

The request

GET /service/Products?$apply=aggregate(tags with union as DistinctTags)

will result in :

{
  "@context": "$metadata#Products(DistinctTags)",
  "value": [
    {"DistinctTags": ["Produce", "Groceries", "GiftShop"]}
  ]
}

Analogous to countdistinct:

Instance comparison uses the definition of equality in OData-URL, section 5.1.1.1.1.

Equals operator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions