Permalink
Browse files

Merge pull request #815 from systay/787

Fixed #787: Issue when comparing array properties with literal collections
  • Loading branch information...
2 parents 1a5830b + 3fb253b commit 15f03c518a967245fb3268b7b7dfe2a0bb604078 @jexp jexp committed Aug 24, 2012
View
@@ -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)
--------------------
@@ -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)
@@ -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)))
+ }
}

0 comments on commit 15f03c5

Please sign in to comment.