-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
groupBy unaware of additional columns resulting from using drafts and orderBy #1080
Comments
Looks like the patch I proposed is incomplete since this request still fails even if the earlier one doesn't: To fix this failure, the second part of my proposed patch could be: // patch: add to groupBy additional columns that are not in the groupBy clause but in the orderBy clause
for (const column of transformedQuery.SELECT.orderBy) {
if (column.ref && transformedQuery.SELECT.groupBy
&& !transformedQuery.SELECT.columns.some(c => c.func && c.as === column.ref[0]) // <- this is new
&& !transformedQuery.SELECT.groupBy.some(e => e.ref?.length === column.ref.length && e.ref.every((p, i) => p === column.ref[i]))) {
transformedQuery.SELECT.groupBy.push(column)
}
}
// end patch Feel free to propose a more thorough solution so that such requests do not fail. Thanks in advance, Georgel |
please check whether it works if you omit the superfluous element |
I've checked and the request fails with the same error even if we omit the orderBy: Also, I cannot find any place in the OData specification that says either that 'superfluous elements should be omitted in orderBy clauses' or that 'if the element is not specified in the group by clause then it must be ignored'. I've looked here:
Should you believe something should change in the OData layer instead of patching Thanks in advance, Georgel P.S. I raised this issue with such seemingly artificial requests because we actually ran into these kind of issues while trying to upgrade to use cds 8 with the new Hana driver in our product. |
Description of erroneous behaviour
GET query in Hana-backed capire/orders service:
Unexpected result:
Perhaps not the best solution but this patch seems to help:
Above patch code snippets as text:
Detailed steps to reproduce
Details about your project
The text was updated successfully, but these errors were encountered: