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

Commit

Permalink
Allow returning 0 count for nulls in OPTIONAL MATCHes. Add very basis…
Browse files Browse the repository at this point in the history
… tests #318
  • Loading branch information
szarnyasg committed Mar 4, 2018
1 parent 31814c6 commit b071cb5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions ire-adapter/src/test/scala/ingraph/ire/TckEngineTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,25 @@ class TckEngineTest extends FunSuite {
assert(results.size == 1)
}

test("count empty on OPTIONAL MATCH") {
val results = run("",
"""OPTIONAL MATCH (n)
|RETURN count(n) AS cn
""".stripMargin
)
assert(results.size == 1)
assert(results.head == Vector(0L))
}

test("count empty on MATCH") {
val results = run("",
"""MATCH (n)
|RETURN count(n) AS cn
""".stripMargin
)
assert(results.isEmpty)
}

// //
// test("") {
// val results = run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AggregationNode(override val next: (ReteMessage) => Unit,

for ((key, (oldValues, oldCount)) <- oldValues) {
val newValues = data(key).map(_.value())
if (oldValues != newValues) {
if (oldValues != newValues || oldCount == 0) {
if (keyCount(key) != 0)
positive += key ++ newValues
if (oldCount != 0)
Expand Down

0 comments on commit b071cb5

Please sign in to comment.