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

Clarify the algorithm for evaluating the compute transformation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: V4.0_CSD04
    • Component/s: Data Aggregation
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      The output set is constructed by copying the instances of the input set and adding one dynamic property per compute expression to each instance of the input output set. The name of the added property is the alias following the as keyword. The value of the property is the value of the compute expression evaluated relative to that instance. Services MAY support expressions that address dynamic properties added by other expressions within the same compute transformation, provided that the service can determine an evaluation sequence.

      Show
      The output set is constructed by copying the instances of the input set and adding one dynamic property per compute expression to each instance of the input output set. The name of the added property is the alias following the as keyword. The value of the property is the value of the compute expression evaluated relative to that instance. Services MAY support expressions that address dynamic properties added by other expressions within the same compute transformation, provided that the service can determine an evaluation sequence.
    • Resolution:
      Show
      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/70489/odata-data-aggregation-ext-v4.0-csd04.docx

      Description

      It seems warranted that compute expressions can use dynamic properties that were computed by previous compute expressions, as in compute(A add B as C, C mul 2 as D).

      And the sequence of the compute expressions should not matter, therefore compute(C mul 2 as D, A add B as C) should produce the same result. The server must determine an appropriate sequence in which to evaluate the compute expressions, or fail if a cycle is detected.

        Attachments

          Activity

          Hide
          mikep Michael Pizzo (Inactive) added a comment - - edited

          Note that SQL seems to require something like a subselect in order to reference a previously computed value.  i.e., given a "users" table with firstName, lastName, and prefix columns, the following does not work:

          select concat(firstName,lastName) as fullName, concat(prefix, fullName) as name from users
          

           though you could do something like:

          select concat(prefix, fullName) as name from (select prefix, concat(firstName, lastName) as fullName from users) as U1
          Show
          mikep Michael Pizzo (Inactive) added a comment - - edited Note that SQL seems to require something like a subselect in order to reference a previously computed value.  i.e., given a "users" table with firstName, lastName, and prefix columns, the following does not work: select concat(firstName,lastName) as fullName, concat(prefix, fullName) as name from users  though you could do something like: select concat(prefix, fullName) as name from (select prefix, concat(firstName, lastName) as fullName from users) as U1
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Similarly, LINQ does not support the following syntax:

          users.Select(u => new { fullName = u.firstName + u.lastName, name = u.prefix + fullName });
          

          (the use of fullName in name=u.prefix + fullName is not valid)

          you would instead need to do:  

          users.Select(u => new { fullName = u.firstName + u.lastName, prefix = u.prefix }).Select(u2 => new { name = u2.prefix + u2.fullName });
          
          Show
          mikep Michael Pizzo (Inactive) added a comment - Similarly, LINQ does not support the following syntax: users.Select(u => new { fullName = u.firstName + u.lastName, name = u.prefix + fullName }); (the use of fullName in name=u.prefix + fullName is not valid) you would instead need to do:   users.Select(u => new { fullName = u.firstName + u.lastName, prefix = u.prefix }).Select(u2 => new { name = u2.prefix + u2.fullName });

            People

            • Assignee:
              Unassigned
              Reporter:
              heiko.theissen Heiko Theissen
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: