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

Incorrect Filter results with IN #6154

Closed
Vitalik13 opened this issue May 27, 2019 · 6 comments · Fixed by #6198
Closed

Incorrect Filter results with IN #6154

Vitalik13 opened this issue May 27, 2019 · 6 comments · Fixed by #6198

Comments

@Vitalik13
Copy link

Vitalik13 commented May 27, 2019

Goals

Correct filtering with predicate

Expected Results

Return all objects with id which are in sequence.

Actual Results

Return only some objects with id which are in sequence.
Снимок экрана 2019-05-27 в 21 18 38

Снимок экрана 2019-05-27 в 21 18 15

Steps to Reproduce

Call method
var result = championship.events.filter("id IN %@",eventIds)

Code Sample

 func filteredChampionshipResult() -> Results<Championship> {
    var result = current.objects(Championship.self)
    result = result.filter("SUBQUERY(events, $event, $event.id IN %@).@count > 0",eventIds)
    return result
}

func eventsResult(for championship:Championship) -> Results<Event> {
    var result = championship.events.filter("id IN %@",eventIds)
    return result
}

Version of Realm and Tooling

Realm framework version: 3.15.0

Xcode version: 10.2.1 (10E1001)

iOS/OSX version: 12.3.1

@Vitalik13 Vitalik13 changed the title Incorrecnt Filter results with IN Incorrect Filter results with IN May 27, 2019
@tgoyne
Copy link
Member

tgoyne commented May 29, 2019

Assuming id doesn't have an index this'll hit the optimization added in realm/realm-core#3271, which would point at a bug in that. If id does have an index (or is the primary key) then nothing should have changed about this in quite a while.

If you can privately share the app code and relevant data needed to reproduce this it'd probably be quite easy to figure out where things are going wrong, but otherwise it may be hard to figure out what the problematic case is as we do have some tests of IN on ints in a subquery.

@gshahbazian
Copy link

@tgoyne hi, thanks for pointing to that change. We were also seeing this bug with realm v3.16, and downgrading to release v3.14 (which doesn't include realm/realm-core#3271) fixes it for us.

Anything I can do to help reproduce/fix please let me know!

@tgoyne
Copy link
Member

tgoyne commented Jun 21, 2019

Another user supplied a repro case for what's probably the same bug in realm-java so we hopefully have what we need to fix this.

@tgoyne
Copy link
Member

tgoyne commented Jul 9, 2019

realm/realm-core#3320 should fix this.

@realm-probot
Copy link

realm-probot bot commented Jul 10, 2019

Hey - looks like you forgot to add a T:* label - could you please add one?

@gshahbazian
Copy link

@tgoyne after upgrading to 3.17.3 we still see the original issue. Was the bug in realm-java confirmed to be fixed?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants