-
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
fix: optimize foreign key access in a join relevant path #481
Conversation
especially for paths of length > 2 fix #479
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
@@ -2080,6 +2076,31 @@ module.exports = Object.assign(cqn4sql, { | |||
notSupportedOps, | |||
}) | |||
|
|||
function calculateElementName(token) { | |||
const nonJoinRelevantAssoc = [...token.$refLinks].findIndex(l => l.definition.isAssociation && l.onlyForeignKeyAccess) | |||
let name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some left over, but should work.
🤖 I have created a release *beep* *boop* --- <details><summary>db-service: 1.6.4</summary> ## [1.6.4](db-service-v1.6.3...db-service-v1.6.4) (2024-02-28) ### Fixed * **`cqn2sql`:** smart quoting also for update statements ([#475](#475)) ([1688f77](1688f77)) * `INSERT` with first `undefined` value ([#484](#484)) ([c21e3c4](c21e3c4)) * Allow SELECT.join queries again with full infer call ([#469](#469)) ([5329ec0](5329ec0)) * optimize foreign key access in a join relevant path ([#481](#481)) ([5e30de4](5e30de4)), closes [#479](#479) </details> <details><summary>hana: 0.0.6</summary> ## [0.0.6](hana-v0.0.5...hana-v0.0.6) (2024-02-28) ### Added * cds.Vector support for the HANAService ([#442](#442)) ([1057a13](1057a13)) ### Fixed * `TypeError` for `cds bind` in MTX scenario ([#482](#482)) ([38722fe](38722fe)) * Allow SELECT.join queries again with full infer call ([#469](#469)) ([5329ec0](5329ec0)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could maybe add
// test that no optimization is done if a filter is applied
SELECT from ClassRoomPupil {
classroom[name = 'Firenze'].ID
}
// test what happens if both an optimizable and a non-optimizable path are present
SELECT from ClassRoomPupil {
classroom.ID,
classroom.name
}
// variation of previous test
SELECT from ClassRoomPupil {
classroom.ID,
classroom[name = 'Firenze'].ID as ID2
}
follow up to review comment: #481 (review)
follow up to review comment: #481 (review)
if the path resolves to a foreign key, we should not create a join for the last association, instead we shortcut to the foreign key. This was not considered for join relevant paths.
fix #479