Skip to content

Conversation

@AndrewSisley
Copy link
Contributor

@AndrewSisley AndrewSisley commented May 2, 2024

Relevant issue(s)

Resolves #2574

Description

Return correct results from one-many joins filtered on an indexed field on the many side.

The invertibleTypeJoin doesn't support the inversion of one-many joins and was converting them into one-one joins.

This means that the index is no longer used if targeting the many side: #2578 (this support can be added after the release).

@AndrewSisley AndrewSisley added bug Something isn't working area/query Related to the query component labels May 2, 2024
@AndrewSisley AndrewSisley added this to the DefraDB v0.11 milestone May 2, 2024
@AndrewSisley AndrewSisley requested a review from a team May 2, 2024 14:40
@AndrewSisley AndrewSisley self-assigned this May 2, 2024
It is annoying to have to keep commenting bits out in order to test one thing, now (ignoring explain) we can test one thing at a time.
So that I can read it, and adjust it to what is under test.  I don't know what the original test data was, so it has also been adjusted in this commit.
Like the multi-query test function, having to comment out the explain query in order to test one thing at a time is annoying.
@AndrewSisley AndrewSisley force-pushed the 2574-index-broken-test branch from c8ef61c to 84e92c5 Compare May 2, 2024 17:54
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for fixing this and the added tests.

@AndrewSisley AndrewSisley merged commit 43cbf47 into sourcenetwork:develop May 3, 2024
@AndrewSisley AndrewSisley deleted the 2574-index-broken-test branch May 3, 2024 15:09
ChrisBQu pushed a commit to ChrisBQu/defradb that referenced this pull request Feb 21, 2025
…rk#2579)

## Relevant issue(s)

Resolves sourcenetwork#2574

## Description

Return correct results from one-many joins filtered on an indexed field
on the many side.

The invertibleTypeJoin doesn't support the inversion of one-many joins
and was converting them into one-one joins.

This means that the index is no longer used if targeting the many side:
sourcenetwork#2578 (this support can
be added after the release).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/query Related to the query component bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestQueryWithIndexOnOneToTwoRelation_IfFilterOnIndexedRelation_ShouldFilter is incorrect

2 participants