{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/8129","repository_url":"https://api.github.com/repos/orientechnologies/orientdb","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/8129/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/8129/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/8129/events","html_url":"https://github.com/orientechnologies/orientdb/issues/8129","id":301204923,"number":8129,"title":"Error parsing MATCH query with \"class\" and \"while\" clauses","user":{"login":"obi1kenobi","id":2348618,"avatar_url":"https://avatars2.githubusercontent.com/u/2348618?v=4","gravatar_id":"","url":"https://api.github.com/users/obi1kenobi","html_url":"https://github.com/obi1kenobi","followers_url":"https://api.github.com/users/obi1kenobi/followers","following_url":"https://api.github.com/users/obi1kenobi/following{/other_user}","gists_url":"https://api.github.com/users/obi1kenobi/gists{/gist_id}","starred_url":"https://api.github.com/users/obi1kenobi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obi1kenobi/subscriptions","organizations_url":"https://api.github.com/users/obi1kenobi/orgs","repos_url":"https://api.github.com/users/obi1kenobi/repos","events_url":"https://api.github.com/users/obi1kenobi/events{/privacy}","received_events_url":"https://api.github.com/users/obi1kenobi/received_events","type":"User","site_admin":false},"labels":[{"id":197557840,"url":"https://api.github.com/repos/orientechnologies/orientdb/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":{"login":"luigidellaquila","id":459289,"avatar_url":"https://avatars0.githubusercontent.com/u/459289?v=4","gravatar_id":"","url":"https://api.github.com/users/luigidellaquila","html_url":"https://github.com/luigidellaquila","followers_url":"https://api.github.com/users/luigidellaquila/followers","following_url":"https://api.github.com/users/luigidellaquila/following{/other_user}","gists_url":"https://api.github.com/users/luigidellaquila/gists{/gist_id}","starred_url":"https://api.github.com/users/luigidellaquila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luigidellaquila/subscriptions","organizations_url":"https://api.github.com/users/luigidellaquila/orgs","repos_url":"https://api.github.com/users/luigidellaquila/repos","events_url":"https://api.github.com/users/luigidellaquila/events{/privacy}","received_events_url":"https://api.github.com/users/luigidellaquila/received_events","type":"User","site_admin":false},"assignees":[{"login":"luigidellaquila","id":459289,"avatar_url":"https://avatars0.githubusercontent.com/u/459289?v=4","gravatar_id":"","url":"https://api.github.com/users/luigidellaquila","html_url":"https://github.com/luigidellaquila","followers_url":"https://api.github.com/users/luigidellaquila/followers","following_url":"https://api.github.com/users/luigidellaquila/following{/other_user}","gists_url":"https://api.github.com/users/luigidellaquila/gists{/gist_id}","starred_url":"https://api.github.com/users/luigidellaquila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luigidellaquila/subscriptions","organizations_url":"https://api.github.com/users/luigidellaquila/orgs","repos_url":"https://api.github.com/users/luigidellaquila/repos","events_url":"https://api.github.com/users/luigidellaquila/events{/privacy}","received_events_url":"https://api.github.com/users/luigidellaquila/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-02-28T22:17:24Z","updated_at":"2018-03-01T14:24:54Z","closed_at":"2018-03-01T12:08:02Z","author_association":"CONTRIBUTOR","body":"### OrientDB Version: 2.2.30\r\n### Java Version: OpenJDK 8\r\n### OS: Linux  \r\n\r\n## Expected behavior\r\nRegardless of other `while` and `where` clauses, a MATCH statement's `class: Foo` clause should behave identically to a `where: (@this INSTANCEOF 'Foo')`.\r\n\r\nFor example, the following two queries should behave identically, without errors, and return the same rows (the only difference is below the `out('Quux_Quux')` part):\r\n```\r\nMATCH {\r\n    class: Foo,\r\n    as: Foo___1\r\n}.out('Foo_Bar') {\r\n    class: Bar,\r\n    as: Bar___1\r\n}.out('Bar_Quux') {\r\n    as: Quux___1\r\n}.out('Quux_Quux') {\r\n    class: Special_Quux,\r\n    while: ($depth < 5),\r\n    where: (name = 'SQ1'),\r\n    as: Special_Quux___1\r\n} RETURN $matches\r\n```\r\nand\r\n```\r\nMATCH {\r\n    class: Foo,\r\n    as: Foo___1\r\n}.out('Foo_Bar') {\r\n    class: Bar,\r\n    as: Bar___1\r\n}.out('Bar_Quux') {\r\n    as: Quux___1\r\n}.out('Quux_Quux') {\r\n    while: ($depth < 5),\r\n    where: ((name = 'SQ1') and (@this INSTANCEOF 'Special_Quux')),\r\n    as: Special_Quux___1\r\n} RETURN $matches\r\n```\r\n\r\n## Actual behavior  \r\nThe first query produces a strange error:\r\n```\r\nError on parsing query\r\nQuery: (select from null)\r\n```\r\n\r\nThe second query runs correctly and returns the correct outputs.\r\n\r\n## Steps to reproduce  \r\nHere's a sample schema and data that exhibit this problem:\r\n```\r\nCREATE CLASS Foo EXTENDS V\r\nCREATE CLASS Bar EXTENDS V\r\nCREATE CLASS Quux EXTENDS V\r\nCREATE CLASS Special_Quux EXTENDS Quux\r\n\r\nCREATE CLASS Foo_Bar EXTENDS E\r\nCREATE CLASS Bar_Quux EXTENDS E\r\nCREATE CLASS Quux_Quux EXTENDS E\r\n\r\nCREATE VERTEX Foo SET name = 'FooA'\r\nCREATE VERTEX Foo SET name = 'FooB'\r\nCREATE VERTEX Foo SET name = 'FooC'\r\n\r\nCREATE VERTEX Bar SET name = 'BarA'\r\nCREATE VERTEX Bar SET name = 'BarB'\r\nCREATE VERTEX Bar SET name = 'BarC'\r\n\r\nCREATE VERTEX Quux SET name = 'Q'\r\nCREATE VERTEX Special_Quux SET name = 'SQ1'\r\nCREATE VERTEX Special_Quux SET name = 'SQ2'\r\n\r\n# Link up Foo -> Bar, matching up letters\r\nCREATE EDGE Foo_Bar FROM (SELECT * FROM Foo WHERE name = 'FooA') TO (SELECT * FROM Bar WHERE name = 'BarA')\r\nCREATE EDGE Foo_Bar FROM (SELECT * FROM Foo WHERE name = 'FooB') TO (SELECT * FROM Bar WHERE name = 'BarB')\r\nCREATE EDGE Foo_Bar FROM (SELECT * FROM Foo WHERE name = 'FooC') TO (SELECT * FROM Bar WHERE name = 'BarC')\r\n\r\n# Link up Bar \"BarA\" -> Quux \"Q\", other Bars -> Special_Quux \"SQ2\"\r\nCREATE EDGE Bar_Quux FROM (SELECT * FROM Bar WHERE name = 'BarA') TO (SELECT * FROM Quux WHERE name = 'Q')\r\nCREATE EDGE Bar_Quux FROM (SELECT * FROM Bar WHERE name = 'BarB') TO (SELECT * FROM Special_Quux WHERE name = 'SQ2')\r\nCREATE EDGE Bar_Quux FROM (SELECT * FROM Bar WHERE name = 'BarC') TO (SELECT * FROM Special_Quux WHERE name = 'SQ2')\r\n\r\n# Link Quux \"Q\" -> Special_Quux \"SQ1\"\r\nCREATE EDGE Quux_Quux FROM (SELECT * FROM Quux WHERE name = 'Q') TO (SELECT * FROM Special_Quux WHERE name = 'SQ1')\r\n```\r\n\r\nThe problematic query is similar to the one in issue #7823, but the symptoms are different (this time we get a parse error instead of no results) and that issue was closed and fixed in 2.2.30. In contrast, this issue is still present in 2.2.30.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/369607210","html_url":"https://github.com/orientechnologies/orientdb/issues/8129#issuecomment-369607210","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/8129","id":369607210,"user":{"login":"obi1kenobi","id":2348618,"avatar_url":"https://avatars2.githubusercontent.com/u/2348618?v=4","gravatar_id":"","url":"https://api.github.com/users/obi1kenobi","html_url":"https://github.com/obi1kenobi","followers_url":"https://api.github.com/users/obi1kenobi/followers","following_url":"https://api.github.com/users/obi1kenobi/following{/other_user}","gists_url":"https://api.github.com/users/obi1kenobi/gists{/gist_id}","starred_url":"https://api.github.com/users/obi1kenobi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obi1kenobi/subscriptions","organizations_url":"https://api.github.com/users/obi1kenobi/orgs","repos_url":"https://api.github.com/users/obi1kenobi/repos","events_url":"https://api.github.com/users/obi1kenobi/events{/privacy}","received_events_url":"https://api.github.com/users/obi1kenobi/received_events","type":"User","site_admin":false},"created_at":"2018-03-01T14:24:53Z","updated_at":"2018-03-01T14:24:53Z","author_association":"CONTRIBUTOR","body":"Thanks for the speedy fix, @luigidellaquila -- much appreciated. \r\n\r\nI took a look at the fix and it looks good. However, I was a bit confused as to why only the `node.in` was looped over -- shouldn't edges in `node.out` be considered as well? Is it certain that all `PatternEdge` edges are `in` on one `PatternNode` and `out` on another, so we only have to iterate one side of the nodes?"}}
{"actor":{"display_login":"obi1kenobi"}}