Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #787: Issue when comparing array properties with literal collec…

…tions
  • Loading branch information...
commit 3fb253b594263a5bbf9d77e2802ebf5c172e82d0 1 parent 1a5830b
@systay authored
View
1  cypher/CHANGES.txt
@@ -8,6 +8,7 @@ o Renamed iterable to collection
o Fixed #795: so that WITH keeps parameters also for empty aggregation results
o Fixed #772: Creating nodes/relationships goes before SET, so SET can run on already created elements
o Added error when using != instead of <>
+o Fixed #787: Issue when comparing array properties with literal collections
1.8.M07 (2012-08-08)
--------------------
View
6 cypher/src/main/scala/org/neo4j/cypher/internal/commands/ComparablePredicate.scala
@@ -50,7 +50,11 @@ case class Equals(a: Expression, b: Expression) extends Predicate with Comparer
def isMatch(m: Map[String, Any]): Boolean = {
val a1 = a(m)
val b1 = b(m)
- a1 == b1
+
+ (a1, b1) match {
+ case (IsIterable(l), IsIterable(r)) => l == r
+ case _ => a1 == b1
+ }
}
def atoms = Seq(this)
def exists(f: (Expression) => Boolean) = a.exists(f) || b.exists(f)
View
18 cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala
@@ -2218,4 +2218,22 @@ RETURN x0.name?
val result = parseAndExecute("START a=node(0) return length([[],[]]+[[]]) as l").toList
assert(result === List(Map("l" -> 3)))
}
+
+ @Test
+ def shouldAllowArrayComparison() {
+ val node = createNode("lotteryNumbers" -> Array(42, 87))
+
+ val result = parseAndExecute("start n=node(1) where n.lotteryNumbers = [42, 87] return n")
+
+ assert(result.toList === List(Map("n" -> node)))
+ }
+
+ @Test
+ def shouldSupportArrayOfArrayOfPrimitivesAsParameterForInKeyword() {
+ val node = createNode("lotteryNumbers" -> Array(42, 87))
+
+ val result = parseAndExecute("start n=node(1) where n.lotteryNumbers in [[42, 87], [13], [42]] return n")
+
+ assert(result.toList === List(Map("n" -> node)))
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.