{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-core/issues/2945","repository_url":"https://api.github.com/repos/realm/realm-core","labels_url":"https://api.github.com/repos/realm/realm-core/issues/2945/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-core/issues/2945/comments","events_url":"https://api.github.com/repos/realm/realm-core/issues/2945/events","html_url":"https://github.com/realm/realm-core/issues/2945","id":279671472,"number":2945,"title":"link query with groups","user":{"login":"beeender","id":449296,"avatar_url":"https://avatars3.githubusercontent.com/u/449296?v=4","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-06T08:49:43Z","updated_at":"2017-12-08T14:15:23Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Issue reported // https://forums.realm.io/t/more-than-one-value-in-a-in-and-i-become-crazy/727/11\r\n\r\nI am trying to build a core test case to reproduce the original java issue, but it doesn't behave as what i expected.\r\n\r\n```C++\r\n// https://forums.realm.io/t/more-than-one-value-in-a-in-and-i-become-crazy/727/11\r\n/*\r\n * realm.insert(getPerson(\"b55d8cb6-f915-4d37-a168-48c3c0fbe602\", \"PERSON_1\", \"SERVICE_1\", \"PROFILE_1\"));\r\n   realm.insert(getPerson(\"c5bea8c7-1f66-455c-b858-e323264b0f27\", \"PERSON_2\", \"SERVICE_1\", \"PROFILE_2\"));\r\n   realm.insert(getPerson(\"3c6ca85b-255b-4e96-a08e-1089c00f7d4f\", \"PERSON_3\", \"SERVICE_2\", \"PROFILE_3\"));\r\n   realm.insert(getPerson(\"d78d500c-6bee-4da4-b370-bd9a3ae9ba2a\", \"PERSON_4\", \"SERVICE_1\", \"PROFILE_4\"));\r\n   realm.insert(getPerson(\"9d18a2b9-c6d0-48be-83c0-57a917a9e2c9\", \"PERSON_5\", \"SERVICE_1\", \"PROFILE_5\"));\r\n */\r\nONLY(Query_Group_bug)\r\n{\r\n    Group g;\r\n    TableRef service_table = g.add_table(\"service\");\r\n    TableRef profile_table = g.add_table(\"profile\");\r\n    TableRef person_table = g.add_table(\"person\");\r\n\r\n    service_table->add_column(type_String, \"id\");\r\n    service_table->add_column_link(type_LinkList, \"profiles\", *profile_table);\r\n\r\n    profile_table->add_column(type_String, \"role\");\r\n    profile_table->add_column_link(type_Link, \"services\", *service_table);\r\n\r\n    person_table->add_column(type_String, \"id\");\r\n    person_table->add_column_link(type_LinkList, \"services\", *service_table);\r\n\r\n    service_table->add_empty_row(2);\r\n    service_table->set_string(0, 0, \"service_1\");\r\n    service_table->set_string(0, 1, \"service_2\");\r\n\r\n    profile_table->add_empty_row(5);\r\n    profile_table->set_string(0, 0, \"profile_1\");\r\n    profile_table->set_string(0, 1, \"profile_2\");\r\n    profile_table->set_string(0, 2, \"profile_3\");\r\n    profile_table->set_string(0, 3, \"profile_4\");\r\n    profile_table->set_string(0, 4, \"profile_5\");\r\n\r\n    service_table->get_linklist(1, 0)->add(0);\r\n    service_table->get_linklist(1, 0)->add(1);\r\n    service_table->get_linklist(1, 1)->add(2);\r\n    service_table->get_linklist(1, 0)->add(3);\r\n    service_table->get_linklist(1, 0)->add(4);\r\n\r\n    profile_table->set_link(1, 0, 0);\r\n    profile_table->set_link(1, 1, 0);\r\n    profile_table->set_link(1, 2, 1);\r\n    profile_table->set_link(1, 3, 0);\r\n    profile_table->set_link(1, 4, 0);\r\n\r\n    person_table->add_empty_row(5);\r\n    person_table->set_string(0, 0, \"person_1\");\r\n    person_table->set_string(0, 1, \"person_2\");\r\n    person_table->set_string(0, 2, \"person_3\");\r\n    person_table->set_string(0, 3, \"person_4\");\r\n    person_table->set_string(0, 4, \"person_5\");\r\n\r\n    person_table->get_linklist(1, 0)->add(0);\r\n    person_table->get_linklist(1, 1)->add(0);\r\n    person_table->get_linklist(1, 2)->add(1);\r\n    person_table->get_linklist(1, 3)->add(0);\r\n    person_table->get_linklist(1, 4)->add(0);\r\n\r\n\r\n    auto& query_service_table = person_table->link(1);\r\n    auto& query_profile_table = query_service_table.link(1);\r\n\r\n    realm::Query q0 = person_table->where()\r\n        .group()\r\n\r\n        .group()\r\n        .and_query(query_profile_table.column<String>(0).equal(\"profile_1\"))\r\n        .Or()\r\n        .and_query(query_profile_table.column<String>(0).equal(\"profile_2\"))\r\n        .end_group()\r\n\r\n        .group()\r\n        .and_query(query_service_table.column<String>(0).equal(\"service_1\"))\r\n        .end_group()\r\n\r\n        .end_group()\r\n\r\n        .Or()\r\n\r\n        .group()\r\n        .equal(0, \"person_3\")\r\n        .end_group()\r\n        ;\r\n\r\n    CHECK_EQUAL(3, q0.count());\r\n}\r\n```\r\n\r\nthe `q0.count()` always give `0` but at least it should be `1` since there is a `Or()` case at the end. why?"},"comment":{"url":"https://api.github.com/repos/realm/realm-core/issues/comments/350272979","html_url":"https://github.com/realm/realm-core/issues/2945#issuecomment-350272979","issue_url":"https://api.github.com/repos/realm/realm-core/issues/2945","id":350272979,"user":{"login":"rrrlasse","id":1110156,"avatar_url":"https://avatars1.githubusercontent.com/u/1110156?v=4","gravatar_id":"","url":"https://api.github.com/users/rrrlasse","html_url":"https://github.com/rrrlasse","followers_url":"https://api.github.com/users/rrrlasse/followers","following_url":"https://api.github.com/users/rrrlasse/following{/other_user}","gists_url":"https://api.github.com/users/rrrlasse/gists{/gist_id}","starred_url":"https://api.github.com/users/rrrlasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrrlasse/subscriptions","organizations_url":"https://api.github.com/users/rrrlasse/orgs","repos_url":"https://api.github.com/users/rrrlasse/repos","events_url":"https://api.github.com/users/rrrlasse/events{/privacy}","received_events_url":"https://api.github.com/users/rrrlasse/received_events","type":"User","site_admin":false},"created_at":"2017-12-08T14:15:23Z","updated_at":"2017-12-08T14:15:23Z","author_association":"CONTRIBUTOR","body":"Looks like a bug - q0.count() should return 5, as far as I can see. I'll check it."}}
{"actor":{"display_login":"rrrlasse"}}