From 5bade310669f02f705a34541cca941a7dd79064d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 8 Jan 2025 17:32:05 +0100 Subject: [PATCH] Simple grouping with untyped properties or open types (#2034) In the simple grouping algorithm, the last sub-bullet point of the projection function says: > Otherwise, if $p'$ is a prefix of a path in $G$, let $v[q]=s_G (u[q],p')$ and the recursively called function $s_G$ assumes that its first argument is a structured instance. But if $q$ is an untyped property or a property of an open type, $u[q]$ can also be primitive1, and then the first bullet point does not make sense: > Let $v$ be an instance of the type of $u$ without properties and without entity-id. I suggest to rephrase the last sub-bullet point so that the recursive call is omitted in such cases. This is the least invasive change and its leads to $q$ being omitted from the projection. 1 Of course $u[q]$ can also be primitive if $q$ declares a primitive type, but the problem occurs only if $p'$ is a prefix of a path in $G$, which means for a grouping criterion of the form $q/r$ or $s/q/r$. And if $q$ declares a primitive type, $q/r$ does not make sense at all. --- docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html | 2 +- docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md | 2 +- odata-data-aggregation-ext/3.2 Basic Aggregation.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html b/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html index c9d45241..fdd665fe 100644 --- a/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html +++ b/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html @@ -1981,7 +1981,7 @@

3.2.
  • If \(u\) has a subtype of the type addressed by \(p\) and \(q\) is only declared on that subtype, let \(p'=p/p''/q\) where \(p''\) is a type-cast to the subtype, otherwise let \(p'=p/q\).
  • If \(p'\) occurs in \(G\), let \(v[q]=u[q]\).
  • -
  • Otherwise, if \(p'\) is a prefix of a path in \(G\), let \(v[q]=s_G(u[q],p')\).
  • +
  • Otherwise, if \(p'\) is a prefix of a path in \(G\) and \(u[q]\) has a structured type, let \(v[q]=s_G(u[q],p')\).
  • Return \(v\).
  • diff --git a/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md b/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md index 7c9ac06b..5f220079 100644 --- a/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md +++ b/docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md @@ -1461,7 +1461,7 @@ The output set of the `groupby` transformation is constructed in five steps. - For each structural or navigation property $q$ of $u$: - If $u$ has a subtype of the type addressed by $p$ and $q$ is only declared on that subtype, let $p'=p/p''/q$ where $p''$ is a type-cast to the subtype, otherwise let $p'=p/q$. - If $p'$ occurs in $G$, let $v[q]=u[q]$. - - Otherwise, if $p'$ is a prefix of a path in $G$, let $v[q]=s_G(u[q],p')$. + - Otherwise, if $p'$ is a prefix of a path in $G$ and $u[q]$ has a structured type, let $v[q]=s_G(u[q],p')$. - Return $v$. 2. The input set is split into subsets where two instances are in the same subset if their projections are [the same](#SamenessandOrder). If [representations of the same non-transient entity](#SamenessandOrder) are encountered during the comparison of two projections, the service MUST assign them to one subset with the merged representation if they are complementary and MUST reject the request if they are contradictory. 3. The set transformations from the second parameter are applied to each subset, resulting in a new set of potentially different structure and cardinality. Associated with each resulting set is the common projection of the instances in the subset from which the resulting set was computed. diff --git a/odata-data-aggregation-ext/3.2 Basic Aggregation.md b/odata-data-aggregation-ext/3.2 Basic Aggregation.md index 0fbc63be..14a73416 100644 --- a/odata-data-aggregation-ext/3.2 Basic Aggregation.md +++ b/odata-data-aggregation-ext/3.2 Basic Aggregation.md @@ -350,7 +350,7 @@ The output set of the `groupby` transformation is constructed in five steps. - For each structural or navigation property $q$ of $u$: - If $u$ has a subtype of the type addressed by $p$ and $q$ is only declared on that subtype, let $p'=p/p''/q$ where $p''$ is a type-cast to the subtype, otherwise let $p'=p/q$. - If $p'$ occurs in $G$, let $v[q]=u[q]$. - - Otherwise, if $p'$ is a prefix of a path in $G$, let $v[q]=s_G(u[q],p')$. + - Otherwise, if $p'$ is a prefix of a path in $G$ and $u[q]$ has a structured type, let $v[q]=s_G(u[q],p')$. - Return $v$. 2. The input set is split into subsets where two instances are in the same subset if their projections are [the same](#SamenessandOrder). If [representations of the same non-transient entity](#SamenessandOrder) are encountered during the comparison of two projections, the service MUST assign them to one subset with the merged representation if they are complementary and MUST reject the request if they are contradictory. 3. The set transformations from the second parameter are applied to each subset, resulting in a new set of potentially different structure and cardinality. Associated with each resulting set is the common projection of the instances in the subset from which the resulting set was computed.