[C-API] Querying on Decimal128 field with value NaN does not find objects

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Performing a query on a Decimal128 field with value NaN does not match object with NaN values for that fields.

      Expected results

      The following model and test should yield a query result with one object:

      class Decimal128Object : RealmObject {
          var decimal128Field : Decimal128
      }
      
      fun test() {
          realm.write {
              copyToRealm(Decimal128Object().apply { decimal128Field = Decimal128.NaN })
          }
          assertEquals(1, realm.query<Decimal128Object>("decimal128Field = $0", Decimal128.NaN).find().size)
      

      From the corresponding test in realm-java it seems that we should be able to query objects by Decimal128.NaN
      https://github.com/realm/realm-java/blob/master/realm/realm-library/src/androidTest/kotlin/io/realm/Decimal128Tests.kt#L284

      Actual Results

      The query results are not holding any objects

      Steps & Code to Reproduce

      The test in Realm Kotlin in https://github.com/realm/realm-kotlin/blob/gagik/decimalsupport/packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/Decimal128Tests.kt#L35 is failing, but only for the NaN and NEGATIVE_NaN values.

      I have verified that the object written is in fact holding the right value by opening the realm file in Realm Studio and from debugging it also seems like the query argument is transferred correctly into Core.

      Core version

      Core version: 13.1.2

            Assignee:
            Jørgen Edelbo (Inactive)
            Reporter:
            Claus Rørbech (Inactive)
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Resolved:
              Archived: