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: enable path expressions in infix filter after exists predicate #875

Merged
merged 17 commits into from
Nov 13, 2024

Conversation

patricebender
Copy link
Member

@patricebender patricebender commented Oct 29, 2024

if a path expression is detected in a infix filter of an association which follows an exists predicate, we add the filter expression as a whole to the exists (<subquery>) and then recursively transform it with cqn4sql to get the proper joins.

Usually, transforming the exists <subquery> is not necessary, because the where clause is already well formed -> there is a mechanism to flag a path expression in this special case as such.

this is just a simple poc… more tests need to be added.

  • exists books[genre.name = 'fiction' and exists author] -> mixed with sibiling exists
  • exists books[uppercase(genre.name) = 'FICTION'] -> detect path expressions anywhere
  • SELECT from Authors:books[genre.name = 'FICTION'] → What about scoped queries?
    • we dont tacke them, yet

fix: nested exists wrapped in xpr
reported in cap/cdsnode/issues/2194

if a path expression is detected in a infix filter of an association which follows an
`exists` predicate, we add the filter expression as a whole to the
`exists (<subquery>)` and then recursively transform it with `cqn4sql`
to get the proper joins.

Usually, transforming the `exists <subquery>` is not necessary, because the
`where` clause is already well formed -> there is a mechanism to flag a
path expression in this special case as such.

this is just a simple poc… more tests need to be added.

- `exists books[genre.name = 'fiction' and exists author]` -> mixed with sibiling `exists`
- `exists books[uppercase(genre.name) = 'FICTION']` -> detect path expressions anywhere
@patricebender patricebender marked this pull request as ready for review November 11, 2024 10:40
@patricebender patricebender requested a review from hm23 November 13, 2024 12:21
@patricebender patricebender enabled auto-merge (squash) November 13, 2024 15:57
@patricebender patricebender merged commit 7e50359 into main Nov 13, 2024
3 checks passed
@patricebender patricebender deleted the patrice/exists-paths branch November 13, 2024 16:08
@cap-bots cap-bots mentioned this pull request Nov 13, 2024
johannes-vogel added a commit that referenced this pull request Nov 14, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[1.15.0](db-service-v1.14.1...db-service-v1.15.0)
(2024-11-14)


### Added

* enable path expressions in infix filter after `exists` predicate
([#875](#875))
([7e50359](7e50359))


### Fixed

* **`search`:** ignore invalid path expressions inside `@cds.search`
([#849](#849))
([250edd5](250edd5))
* nested exists wrapped in xpr
([7e50359](7e50359))
</details>

<details><summary>sqlite: 1.7.7</summary>

##
[1.7.7](sqlite-v1.7.6...sqlite-v1.7.7)
(2024-11-14)


### Fixed

* boolean for sql_simple_queries
([#886](#886))
([d8139fa](d8139fa))
</details>

<details><summary>postgres: 1.10.4</summary>

##
[1.10.4](postgres-v1.10.3...postgres-v1.10.4)
(2024-11-14)


### Fixed

* enable nulls first
([#893](#893))
([6684436](6684436))
</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 <[email protected]>
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.

3 participants