-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: V4.0_CS02
-
Fix Version/s: V4.0_CSD04
-
Component/s: Data Aggregation
-
Labels:None
-
Environment:
Applied
-
Proposal:
A CustomAggregate annotation defines a dynamic property that can be used in the aggregate transformation. The current document states in 6.2.3 Custom Aggregates, second paragraph: “When applied to a structured type, the annotation specifies custom aggregates that are available for collections of instances of that structured type.”
This also means that a custom aggregate cannot be applied to an intermediate, already aggregated result produced by $apply transformations. Such a result consists of aggregated instances that are based on the structure of the instances from which they have been calculated (4 Representation of Aggregated Instances) and some properties from the originating type have been aggregated away.
This limits the applicability of custom aggregates and prevents requests for use cases like this example: For a custom aggregate “Amount”, determine the total amount for countries with a sales amount greater than X:
GET ~/Sales?$apply=groupby((Country),aggregate(Amount))/filter(Amount gt X)/aggregate(Amount)
This can be a valid request under the assumption that Amount can be calculated for a set of aggregated instances each having a value for the Amount property.