Skip to content
This repository has been archived by the owner on Apr 4, 2021. It is now read-only.

Bad plan for UNWIND and MATCH #380

Open
szarnyasg opened this issue Oct 7, 2018 · 0 comments
Open

Bad plan for UNWIND and MATCH #380

szarnyasg opened this issue Oct 7, 2018 · 0 comments
Assignees
Labels

Comments

@szarnyasg
Copy link
Member

szarnyasg commented Oct 7, 2018

To reproduce the issue, add the following to one of the compiler tests, e.g. RandomCompilationTest:

  test("Indexing array in MATCH") {
    val stages = compile(
      """UNWIND [[20, 30]] AS tuple
        |MATCH (org:Organisation {id: tuple[0]})
        |RETURN org.id
      """.stripMargin)
    printlnSuppressIfIngraph(stages.toString)
  }

This results in:

'Production
+- 'Projection [ret(p(id, v(org, {}, false, (org#0)), (org.id#0)), (org.id), (org.id#1))]
   +- 'Join
      :- 'Unwind unwindattribute(listexpression(listexpression(20, 30)), tuple, (tuple#0))
      :  +- Dual
      +- 'AllDifferent
         +- 'Selection (p(id, v(org, {}, false, (org#0)), (org.id#0)) = indexlookupexpression(unwindattribute(listexpression(listexpression(20, 30)), tuple, (tuple#0)), 0))
            +- 'GetVertices v(org, {Organisation}, (id,indexlookupexpression(unwindattribute(listexpression(listexpression(20, 30)), tuple, (tuple#0)), 0)), false, (org#0))

This plan does not work because the Selection operator is trying to filter for tuple#0, which is produced on the other branch of the Join operator (by the Unwind operator).

This currently blocks Interactive update 1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants