-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major
-
Affects Version/s: V4.0_CS02
-
Component/s: Data Aggregation
-
None
-
Environment:
Applied
The specification text contains an example for tranformation outerjoin whose result is applied to a subsequent groupby transformation:
Example 66:
GET ~/Customers?$apply=outerjoin(Sales as ProductSales) /groupby((Country,ProductSales/Product/Name))
returning
{
"@odata.context":"$metadata#Customers(Country,ProductSales(Product(Name)))",
"value": [
{ "Country": "Netherlands",
"ProductSales": { "Product": { "Name": "Paper" } } },
{ "Country": "Netherlands",
"ProductSales": { "Product": { "Name": "Sugar" } } },
{ "Country": "USA",
"ProductSales": { "Product": { "Name": "Coffee" } } },
{ "Country": "USA",
"ProductSales": { "Product": { "Name": "Paper" } } },
{ "Country": "USA",
"ProductSales": { "Product": { "Name": "Sugar" } } },
{ "Country": "France", "ProductSales": null }
]
}
—
Looking at the first step, outerjoin returns combinations of customer instances and the related sales instances:
[
{ 'ID': 'C1', 'Name': 'Joe', 'Country': 'USA', 'ProductSales': { 'ID': '1', … } },
{ 'ID': 'C1', 'Name': 'Joe', 'Country': 'USA', 'ProductSales': { 'ID': '2', … } },
…
{ 'ID': 'C4', 'Name': Luc', 'Country': France', 'ProductSales': null }
]
The following groupby operates on two grouping properties: Country and ProductSales/Product/Name.
The latter property path is not defined for the last instance returned by outerjoin. Intuition says its value should be null.
It should be clarified
- that the value for such a property path is clearly defined in some specification, when a leading segment is already null
- how the groupby result should look like for the last instance returned by outerjoin:
- like shown above:
'ProductSales': null - returning the complete structure of the grouping property:
{{ 'ProductSales':Unknown macro: { 'Product'}}
- like shown above: