Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-1459

Clarify representation of property paths in groupby with leading segments being null

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: V4.0_CS02
    • Fix Version/s: V4.0_CSD04
    • Component/s: Data Aggregation
    • Labels:
      None
    • Proposal:
      Hide

      5.1.1.15 Path Expressions states that a property path has value null, if one if its complex properties is null, or no entity is related. Hence, all of the following possible input entities will be grouped under the same value null for the requested Name property:

      [ {"ProductSales": null},
        {"ProductSales": {"Product": null}},
        {"ProductSales": {"Product": { "Name": null }}} ]
      

       Therefore, the result of the groupby }}in example 66 includes a {{null value for the last instance.:

      { "Country": "France",
            "ProductSales": { "Product": { "Name": null  } } }
      

      The specification text needs to be fixed accordingly.

      Show
      5.1.1.15 Path Expressions  states that a property path has value null , if one if its complex properties is null, or no entity is related. Hence, all of the following possible input entities will be grouped under the same value null for the requested Name property: [ { "ProductSales" : null }, { "ProductSales" : { "Product" : null }}, { "ProductSales" : { "Product" : { "Name" : null }}} ]  Therefore, the result of the groupby }}in example 66 includes a {{null value for the last instance.: { "Country" : "France" ,        "ProductSales" : { "Product" : { "Name" : null   } } } The specification text needs to be fixed accordingly.

      Description

      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

      1. that the value for such a property path is clearly defined in some specification, when a leading segment is already null
      2. how the groupby result should look like for the last instance returned by outerjoin:
        1. like shown above:
          'ProductSales': null
        2. returning the complete structure of the grouping property:
          {{ 'ProductSales':
          Unknown macro: { 'Product'}

          }

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gerald.krause1 Gerald Krause
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: