Giter Club home page Giter Club logo

Comments (4)

kneth avatar kneth commented on June 2, 2024

@jd565 Thank you for taking the time to report.

@ironage Do you have any ideas?

from realm-java.

ironage avatar ironage commented on June 2, 2024

Hi @jd565
Assuming 3 objects with member_ids of 100, 101, 102 then we'd expect the following matches for these queries:

query result objects by member_id
member_id == NONE {100, 101, 102} no results
member_id == NONE {100, 101} 102
member_id == NONE {100} 101, 102
member_id == ANY {100, 101, 102} 100, 101, 102
member_id == ANY {100, 101} 100, 101
member_id == ANY {100} 100

We can read member_id == NONE {100, 101, 102} as "match all members who have a member_id that equals none of {100, 101, 102}".
From your expectations, I think you are looking to use the ANY query instead of NONE. Let me know if that works for you.

from realm-java.

jd565 avatar jd565 commented on June 2, 2024

@ironage Thanks for taking a look.
The table above is not the behaviour I am seeing.
I am inserting 100, 101 and 102 ids into the table, then have this code in a test:

        val nonMatching = realm.where<RealmProfile>()
            .rawPredicate("${RealmProfile.MEMBER_ID} == NONE {100}")
            .findAll()
            .map { it.memberID }
        assertEquals(listOf(101, 102), nonMatching)

that is, I want to find all the profiles without member id 100, expecting this to return just the members with id 101 and 102, but my test fails with the following:

java.lang.AssertionError: expected:<[101, 102]> but was:<[100]>

Suggesting that the raw predicate is not doing what you have outlined in your message above.

If I have multiple items inside the NONE, like NONE {100, 101}, then the query correctly returns only member 102, so it seems to only be a problem when a single element is inside the NONE query

from realm-java.

ironage avatar ironage commented on June 2, 2024

@jd565 thanks for the clarification. I wasn't able to reproduce, until I add an index to test property (this applies to you if member_id is a primary key or if you have added an index manually). I submitted a fix in realm/realm-core#7333, but until that lands, I'd suggest that you change your query to be member_id != ALL {...} which should produce equivalent results for the time being. Thanks for reporting this bug to us!

from realm-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.