Closed szarnyasg closed 6 years ago
cc @jmarton
Let's take a look at the following query in TckEngineTest
/A simple pattern with one bound endpoint - edited
MATCH (a:A)-[r:REL]->(b:B)
WITH a AS b, b AS tmp, r AS r
WITH b AS a, r
ORDER BY a.x, b.x
LIMIT 1
MATCH (a)-[r:REL]->(b)
RETURN a, r, b
In
ORDER BY
clauses, we can use attributes created in theWITH
/RETURN
clause and also the ones that will be removed by the projection:Note that this is not true if there are aggregates:
Anyways, even this simple case does not work now:
The reason for this is that the query plan is incorrect, as it compiles this to a sequence of a projection, sort and top operations - and the projection removes attributes that should be used for sorting.