realm / realm-core

Core database component for the Realm Mobile Database SDKs

Home Page:https://realm.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RQL IN-operator broken on master

nielsenko opened this issue · comments

As discussed Friday on slack.

The test:

test('Query on RealmSet with IN-operator', () {
    var config = Configuration.local([TestRealmSets.schema, Car.schema]);
    var realm = getRealm(config);

    final cars = [Car("Tesla"), Car("Ford"), Car("Audi")];
    final testSets = TestRealmSets(1)..objectsSet.addAll(cars);

    realm.write(() {
      realm.add(testSets);
    });
    final result = testSets.objectsSet.query(r'make IN $0', [
      ['Tesla', 'Audi']
    ]);
    expect(result.length, 2);
  });

fails with:

00:00 +0 -1: Query on RealmSet with IN-operator [E]
  Expected: <2>
    Actual: <0>

  package:matcher                 expect
  test/realm_set_test.dart 810:5  main.<fn>

when using head of master on realm-core, ie:
* 8e4887f87 (HEAD -> master, origin/master, origin/HEAD) RCORE-2098: Fix issue with OR of two IN queries (#7628)

➤ PM Bot commented:

Jira ticket: RCORE-2102

This is not fixed by je/query-in (#7629) as it looks currently:

* fe11cb88f (HEAD -> je/query-in, origin/je/query-in) Make 'Any' default when using the 'IN' operator

Running with full log on the realm.storage.query category yields:

dart test test/realm_set_test.dart -n "IN-operator"
00:00 +0: (setUpAll)
Current GroupID 662a460ad73ee0cbb7997c27
Validating initial sync for 662a460ad73ee0cbb7997c34 is complete...
Initial sync for flexible is complete.
Validating initial sync for 662a460fd73ee0cbb7997e8c is complete...
Initial sync for staticSchema is complete.
Current PID 25271; OS macos, 64 bit, CPU arm64
00:00 +0 -1: Query on RealmSet with IN-operator [E]
  Expected: <2>
    Actual: <0>

  package:matcher                 expect
  test/realm_set_test.dart 814:5  main.<fn>

(category: Realm.Storage, level: LogLevel.detail, message: DB: 2081 Thread 0x16de5b000: Open file: /var/folders/8p/4znrjyy500q5qtyknc6jmm9h0000gp/T/realm_test_BALJd1/mcethcczxg.realm)
(category: Realm.Storage.Query, level: LogLevel.debug, message: DB: 2081 Thread 0x16de5b000: Query count: 'make IN {"Tesla", "Audi"} VIEW { 3 element(s) }', limit = -1)
(category: Realm.Storage.Query, level: LogLevel.debug, message: DB: 2081 Thread 0x16de5b000: Query matches: 0, Duration: 9 us)
(category: Realm.Storage.Query, level: LogLevel.debug, message: DB: 2081 Thread 0x16de5b000: Query count: 'make IN {"Tesla", "Audi"} VIEW { 3 element(s) }', limit = -1)
(category: Realm.Storage.Query, level: LogLevel.debug, message: DB: 2081 Thread 0x16de5b000: Query matches: 0, Duration: 4 us)
(category: Realm.Storage, level: LogLevel.detail, message: DB: 2081 Thread 0x16de5b000: DB closed)

To run this test again: /Users/kasper/.puro/envs/stable/flutter/bin/cache/dart-sdk/bin/dart test test/realm_set_test.dart -p vm --plain-name 'Query on RealmSet with IN-operator'
00:00 +0 -1: Some tests failed.

Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.

This is fixed by @ironage's PR.