Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug when using aggregates and limit/skip

  • Loading branch information...
commit 5d66edb48d28f58b89fe419688e48af9a45a2635 1 parent 55a7a1c
@systay authored
View
3  cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionPlanImpl.scala
@@ -259,8 +259,7 @@ class ExecutionPlanImpl(query: Query, graph: GraphDatabaseService) extends Execu
case RelationshipById(varName, id) => new RelationshipStartPipe(lastPipe, varName, m => makeNodes[Relationship](id(m), varName, graph.getRelationshipById))
}
- private def canUseOrderedAggregation(sortColumns: Seq[String], keyColumns: Seq[String]): Boolean = keyColumns.take(sortColumns.size) == sortColumns
-
+ private def canUseOrderedAggregation(sortColumns: Seq[String], keyColumns: Seq[String]): Boolean = false
private def makeNodes[T](data: Any, name: String, getElement: Long => T): Seq[T] = {
def castElement(x: Any): T = x match {
case i: Int => getElement(i)
View
21 cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala
@@ -1650,4 +1650,25 @@ RETURN x0.name?
db.shutdown()
}
}
+
+ @Test def different_results_on_ordered_aggregation_with_limit() {
+ val root = createNode()
+ val n1 = createNode("x" -> 1)
+ val n2 = createNode("x" -> 2)
+ val m1 = createNode()
+ val m2 = createNode()
+
+ relate(root, n1)
+ relate(n1, m1)
+
+ relate(root, n2)
+ relate(n2, m2)
+
+ val q = "start a=node(1) match a-->n-->m return n.x, count(*) order by n.x"
+
+ val resultWithoutLimit = parseAndExecute(q)
+ val resultWithLimit = parseAndExecute(q + " limit 1000")
+
+ assert(resultWithLimit.toList === resultWithoutLimit.toList)
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.