You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recently released realm-core caused a test failure in the Dart SDK:
The important part of the test is:
final results = realmObject.list.query(r"nullableDecimalProp IN $0 || stringProp IN $0", [
['text1', null, 2.2, 3] // Searching by different type of values and null
]);
where realmObject.list is a list of embedded objects with a nullableDecimalProp (with type Decimal128?) and a stringProp (with type String).
This query now throws an error, since you cannot compare nullableDecimalProp with 'text1' because of the type mismatch.
This a change in semantics, and I believe one we should avoid. Let me try to explain.
From a mathematical point of view, if x in X and y in Y, then both x and y in X union Y. If x can never be in Y does not change that fact. For the example above, just because nullabeDecimalProp can never be a String does not imply that it cannot be a member of a set, that happens to also contain Strings.
As I can understand this issue arise from the fact that IN in realm, semantically behave like a gigantic OR clause, so x in {y, z} is equivalent to x == z OR x == y. But I would argue that even such an expression should not throw as long as one of the sides can be true.
Expected results
Test should pass
Actual Results
00:02 +27 ~1 -1: Query embedded objects list with list argument with different type of values [E]
RealmException: Cannot convert 'text1' to a unknown. Error code: 3015.
package:realm_dart/src/native/realm_core.dart 142:11 _RealmCore.throwLastError.<fn>
...
Steps & Code to Reproduce
run dart test -j1 test/embedded_test.dart (on fx. release/2.2.1 branch)
Core version
Core version: v14.7.0
The text was updated successfully, but these errors were encountered:
The recently released realm-core caused a test failure in the Dart SDK:
The important part of the test is:
where
realmObject.list
is a list of embedded objects with anullableDecimalProp
(with typeDecimal128?
) and astringProp
(with typeString
).This query now throws an error, since you cannot compare
nullableDecimalProp
with 'text1' because of the type mismatch.This a change in semantics, and I believe one we should avoid. Let me try to explain.
From a mathematical point of view, if x in X and y in Y, then both x and y in X union Y. If x can never be in Y does not change that fact. For the example above, just because
nullabeDecimalProp
can never be aString
does not imply that it cannot be a member of a set, that happens to also containString
s.As I can understand this issue arise from the fact that
IN
in realm, semantically behave like a giganticOR
clause, sox in {y, z}
is equivalent tox == z OR x == y
. But I would argue that even such an expression should not throw as long as one of the sides can be true.Expected results
Test should pass
Actual Results
Steps & Code to Reproduce
run
dart test -j1 test/embedded_test.dart
(on fx.release/2.2.1
branch)Core version
Core version: v14.7.0
The text was updated successfully, but these errors were encountered: