Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1403

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 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:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            claus.rorbech@mongodb.com Claus Rørbech (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: