oasis-tcs / odata-abnf

OASIS OData TC: Supporting an ABNF for OData URLs, headers, and literal data values
https://github.com/oasis-tcs/odata-abnf
Other
11 stars 5 forks source link

`from` multiple dimensions #82

Closed HeikoTheissen closed 2 years ago

HeikoTheissen commented 2 years ago

from allows only one dimension per aggregation step. But multiple dimensions may be desired (for example, ControllingArea,CostCenter), because the number of steps influences the result of average, say.

Suggested alternative definition

In the following $P_1,…,P_n$ are groupable properties, $M$ is an aggregation method and $C$ a custom aggregate. ... from ... denotes a sequence of from and with clauses ending in a from clause. The sequence can be empty if [... from ...] is enclosed in brackets.

If $A$ is an aggregate expression like in the first column, then the expression in the third column is another aggregate expression whose type is defined in the fourth column and which evaluates to the value of the single property in the single instance in the output set of the expression in the fifth column. This rule can be applied repeatedly and lead to multiple from clauses in one aggregate expression.

Aggregate expression type of $A$ Aggregate-from expression type evaluates to
$A$ 1, 2 or 3 $A$ from $P_1,…,P_n$ with $M$ 1 groupby(($P_1,…,P_n$), aggregate($A$ as $A_1$))/aggregate($A_1$ with $M$ as $D$)
$A=C$ [... from ...] 4 $A$ from $P_1,…,P_n$ with $M$ 1 groupby(($P_1,…,P_n$), aggregate($A$))/aggregate($C$ with $M$ as $D$)
$A=C$ [... from ...] 4 $A$ from $P_1,…,P_n$ 4 groupby(($P_1,…,P_n$), aggregate($A$))/aggregate($C$)
$A=C$ ... from ... with $M$ 1 $A$ from $P_1,…,P_n$ 4 groupby(($P_1,…,P_n$), aggregate($A$ as $A_1$))/aggregate($C$)