OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-1158) Transformations for limiting the number of entities in the result of a $apply transformation


Gerald Krause created ODATA-1158:
------------------------------------

             Summary: Transformations for limiting the number of entities in the result of a $apply transformation 
                 Key: ODATA-1158
                 URL: https://issues.oasis-open.org/browse/ODATA-1158
             Project: OASIS Open Data Protocol (OData) TC
          Issue Type: New Feature
          Components: Extension for Data Aggregation
    Affects Versions: V4.0_CSD03
         Environment: Proposed
            Reporter: Gerald Krause
             Fix For: V4.0_CSD04


Transformation concat combines entity collections returned by two or more transformation sequences in a new, concatenated collection.

For limiting the number of items returned from the overall result collection, today the only way is to use system query options $skip and $top. It is currently not possible to limit the individual result collections of the transformation sequences passed to concat. 

There are use cases requiring this ability. As an example, consider a request asking for (1) the grand total sales amount along with (2) the sales figures for the first 10 customers. Note that (1) may return a collection with more than one entry in case multiple currencies are involved, hence a global $top does not give full control to the client. In the worst case with more than ten currencies, not a single customer sales amount would be returned. If the aggregated result is put into a stable order with the orderby transformation (described in <issue>), this can be avoided with a top transformation: 

GET ~/Sales?$apply=
    concat( groupby( (Currency), Amount with sum as TotalAmount ),
            groupby( (Customer,Currency), Amount with sum as TotalAmount )
            /orderby( Customer,Currency )
            /top( 10 )
          )

Another example also involving a skip transformation could be a request fetching sales amounts per customer and month in pages of ten data points per request, complemented with minimum and maximum amounts of the entities on this page. The request for the fourth page would look like:

GET ~/Sales?$apply=
    groupby( (Customer,Time/Month,Currency), Amount with sum as TotalAmount ),
    /orderby( Customer,Time/Month,Currency )
    /skip( 30 )/top( 10 )
    /concat( 
         identity, 
         aggregate( Amount with min as MinAmount, Amount with max as MaxAmount ) )




--
This message was sent by Atlassian JIRA
(v6.2.2#6258)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]