Skip to content
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

feat: assoc-like calc elements after exists predicate #831

Merged
merged 11 commits into from
Oct 15, 2024

Conversation

patricebender
Copy link
Member

as documented in #830, assoc-like calculated elements are re-written by the compiler to include the calculation directives in their on-conditions. Hence, we can allow those assoc-like calculated elements everywhere, where unmanaged associations can be used:

  1. exists predicate
  2. scoped queries
  3. nested projections

this PR implements 1. and 2.

Association like calculated elements have been re-written by the compiler
they essentially behave like unmanaged associations as their calculations
have been incorporated into an on-condition which is handled elsewhere

→ We don't need to treat them any different than a regular unmanaged association.
Base automatically changed from patrice/calc to main October 9, 2024 14:55
it('exists cannot leverage calculated elements which is an expression', () => {
// at the leaf of a where exists path, there must be an association
expect(() => cqn4sql(CQL`SELECT from booksCalc.Books { ID } where exists authorFullName`, model)).to.throw(
`Expecting path “authorFullName” following “EXISTS” predicate to end with association/composition, found “expression”`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just omit the , found “expression” suffix, if the type cannot be determined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like most ', found an expression` , but that probably doesn't fit the msg schema.
But I think the information that it is an expression (and not a string) is helpful, so I wouldn't drop it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do it, why not use the nice prosa :)

it('exists cannot leverage calculated elements which is an expression', () => {
// at the leaf of a where exists path, there must be an association
expect(() => cqn4sql(CQL`SELECT from booksCalc.Books { ID } where exists authorFullName`, model)).to.throw(
`Expecting path “authorFullName” following “EXISTS” predicate to end with association/composition, found “expression”`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like most ', found an expression` , but that probably doesn't fit the msg schema.
But I think the information that it is an expression (and not a string) is helpful, so I wouldn't drop it

@patricebender patricebender enabled auto-merge (squash) October 15, 2024 12:39
@patricebender patricebender merged commit 05f7d75 into main Oct 15, 2024
3 checks passed
@patricebender patricebender deleted the patrice/calc-exists branch October 15, 2024 12:47
@cap-bots cap-bots mentioned this pull request Oct 15, 2024
johannes-vogel added a commit that referenced this pull request Oct 15, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>db-service: 1.14.0</summary>

##
[1.14.0](db-service-v1.13.0...db-service-v1.14.0)
(2024-10-15)


### Added

* assoc-like calc elements after exists predicate
([#831](#831))
([05f7d75](05f7d75))


### Fixed

* Improved behavioral consistency between the database services
([#837](#837))
([b6f7187](b6f7187))
* Treat assoc-like calculated elements as unmanaged assocs
([#830](#830))
([cbe0df7](cbe0df7))
</details>

<details><summary>sqlite: 1.7.4</summary>

##
[1.7.4](sqlite-v1.7.3...sqlite-v1.7.4)
(2024-10-15)


### Fixed

* Improved behavioral consistency between the database services
([#837](#837))
([b6f7187](b6f7187))
</details>

<details><summary>postgres: 1.10.1</summary>

##
[1.10.1](postgres-v1.10.0...postgres-v1.10.1)
(2024-10-15)


### Fixed

* add cds schema for postgres build plugin
([#843](#843))
([6306d5c](6306d5c))
* Improved behavioral consistency between the database services
([#837](#837))
([b6f7187](b6f7187))
* null as default value
([#845](#845))
([0041ec0](0041ec0))
</details>

<details><summary>hana: 1.3.1</summary>

##
[1.3.1](hana-v1.3.0...hana-v1.3.1)
(2024-10-15)


### Fixed

* combination of groupby and orderby
([#825](#825))
([10e0534](10e0534))
* Improved behavioral consistency between the database services
([#837](#837))
([b6f7187](b6f7187))
* list optimization for `Buffer` values
([#817](#817))
([3e60de2](3e60de2))
* null as default value
([#845](#845))
([0041ec0](0041ec0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Johannes Vogel <johannes.vogel@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants