Skip to content

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

@rorbech

Description

@rorbech

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions