diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/FunctionsAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/FunctionsAcceptanceTest.scala
index bdd3344104c97..b1c9981a81e9a 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/FunctionsAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/FunctionsAcceptanceTest.scala
@@ -647,7 +647,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
val expected = createNode().getId
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n) RETURN id(n)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n) RETURN id(n)")
// THEN
result.toList should equal(List(Map("id(n)" -> expected)))
@@ -659,7 +659,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
val expected = relate(createNode(), createNode()).getId
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH ()-[r]->() RETURN id(r)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH ()-[r]->() RETURN id(r)")
// THEN
result.toList should equal(List(Map("id(r)" -> expected)))
@@ -670,7 +670,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
relate(createNode(), createNode(), "T")
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH ()-[r]->() RETURN type(r)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH ()-[r]->() RETURN type(r)")
// THEN
result.toList should equal(List(Map("type(r)" -> "T")))
@@ -683,7 +683,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
relate(intermediate, createNode(), "T2")
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH ()-[r1]->()-[r2]->() RETURN type(r1), type(r2)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH ()-[r1]->()-[r2]->() RETURN type(r1), type(r2)")
// THEN
result.toList should equal(List(Map("type(r1)" -> "T1", "type(r2)" -> "T2")))
@@ -694,7 +694,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
createNode()
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a) OPTIONAL MATCH (a)-[r:NOT_THERE]->() RETURN type(r)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a) OPTIONAL MATCH (a)-[r:NOT_THERE]->() RETURN type(r)")
// THEN
result.toList should equal(List(Map("type(r)" -> null)))
@@ -705,7 +705,7 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
relate(createNode(), createNode(), "T")
// WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a) OPTIONAL MATCH (a)-[r:T]->() RETURN type(r)")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a) OPTIONAL MATCH (a)-[r:T]->() RETURN type(r)")
// THEN
result.toList should equal(List(Map("type(r)" -> "T"), Map("type(r)" -> null)))
@@ -717,7 +717,6 @@ class FunctionsAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTes
val query: String = "MATCH (a)-[r]->() WITH [r, 1] as coll RETURN [x in coll | type(x) ]"
//Expect
- a [SyntaxException] shouldBe thrownBy(eengine.execute(s"CYPHER runtime=compiled $query", Map.empty[String,Any], graph.session()))
a [SyntaxException] shouldBe thrownBy(eengine.execute(s"CYPHER runtime=interpreted $query", Map.empty[String,Any], graph.session()))
a [SyntaxException] shouldBe thrownBy(eengine.execute(s"CYPHER planner=cost $query", Map.empty[String,Any], graph.session()))
a [SyntaxException] shouldBe thrownBy(eengine.execute(s"CYPHER planner=rule $query", Map.empty[String,Any], graph.session()))
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/MatchAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/MatchAcceptanceTest.scala
index 1e8254f4bef1c..23a82f4f9a4db 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/MatchAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/MatchAcceptanceTest.scala
@@ -197,7 +197,7 @@ class MatchAcceptanceTest extends ExecutionEngineFunSuite with QueryStatisticsTe
createNodes("A", "B", "C")
relate("A" -> "KNOWS" -> "B")
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a {name:'A'}),(c {name:'C'}) match (a)-->(b) return a,b,c").toSet
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a {name:'A'}),(c {name:'C'}) match (a)-->(b) return a,b,c").toSet
result should equal (Set(Map("a" -> node("A"), "b" -> node("B"), "c" -> node("C"))))
}
@@ -323,7 +323,7 @@ class MatchAcceptanceTest extends ExecutionEngineFunSuite with QueryStatisticsTe
relate(b, x1, "REL", "BX1")
relate(b, x2, "REL", "BX2")
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode( """
+ val result = executeWithAllPlannersAndCompatibilityMode( """
MATCH (a {name:'A'}), (b {name:'B'})
MATCH (a)-[rA]->(x)<-[rB]->(b)
return x""")
@@ -347,7 +347,7 @@ return x""")
relate(c, x1, "REL", "CX1")
relate(c, x2, "REL", "CX2")
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode( """
+ val result = executeWithAllPlannersAndCompatibilityMode( """
MATCH (a {name:'A'}), (b {name:'B'}), (c {name:'C'})
match (a)-[rA]->(x), (b)-[rB]->(x), (c)-[rC]->(x)
return x""")
@@ -386,7 +386,7 @@ return x""")
relate(c, g)
relate(c, j)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode( """
+ val result = executeWithAllPlannersAndCompatibilityMode( """
MATCH (a {name:'a'}), (b {name:'b'}), (c {name:'c'})
match (a)-->(x), (b)-->(x), (c)-->(x)
return x""")
@@ -557,7 +557,7 @@ RETURN other""")
val a = createNode()
val b = createNode("Mark")
relate(a, b)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode( """
+ val result = executeWithAllPlannersAndCompatibilityMode( """
MATCH (n)-->(x0)
OPTIONAL MATCH (x0)-->(x1)
WHERE x1.foo = 'bar'
@@ -592,7 +592,7 @@ RETURN a.name""")
val a = createNode()
val b = createNode()
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n) return n")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n) return n")
result.columnAs[Node]("n").toSet should equal (Set(a, b))
}
@@ -600,7 +600,7 @@ RETURN a.name""")
val a = createNode()
val b = createNode()
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a), (b) where a <> b return a,b")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a), (b) where a <> b return a,b")
result.toSet should equal (Set(Map("a" -> b, "b" -> a), Map("b" -> b, "a" -> a)))
}
@@ -612,7 +612,7 @@ RETURN a.name""")
relate(a, b)
relate(b, c)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-->(b), (b)-->(b) return b")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-->(b), (b)-->(b) return b")
result shouldBe 'isEmpty
}
@@ -625,7 +625,7 @@ RETURN a.name""")
relate(a, b)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-[r]->(a) return r")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-[r]->(a) return r")
result.toList should equal (List(Map("r" -> r)))
}
@@ -671,7 +671,7 @@ return b
val b = createNode()
relate(a, b, "REL")
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-[:REL|:REL]->(b) return b").toList
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-[:REL|:REL]->(b) return b").toList
result should equal (List(Map("b" -> b)))
}
@@ -699,7 +699,7 @@ return b
val n = createNode("foo" -> "bar")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n) where n.foo = 'bar' return n")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n) where n.foo = 'bar' return n")
// then
result.toList should equal (List(Map("n" -> n)))
@@ -755,7 +755,7 @@ return b
test("should preserve the original matched values if optional match matches nothing") {
val n = createNode()
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n) OPTIONAL MATCH (n)-[:NOT_EXIST]->(x) RETURN n, x")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n) OPTIONAL MATCH (n)-[:NOT_EXIST]->(x) RETURN n, x")
result.toList should equal (List(Map("n" -> n, "x" -> null)))
}
@@ -808,7 +808,7 @@ return b
relate(a, b2)
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(s"MATCH (a)-->(b:foo) RETURN b")
+ val result = executeWithAllPlannersAndCompatibilityMode(s"MATCH (a)-->(b:foo) RETURN b")
// THEN
result.toList should equal (List(Map("b" -> b1)))
@@ -822,7 +822,7 @@ return b
relate(createLabeledNode("A"), createLabeledNode("A"))
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(s"MATCH (a:A)-[r]->(b:B) RETURN r")
+ val result = executeWithAllPlannersAndCompatibilityMode(s"MATCH (a:A)-[r]->(b:B) RETURN r")
// THEN
result.toSet should equal (Set(Map("r" -> r)))
@@ -839,7 +839,7 @@ return b
createLabeledNode("C")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(s"MATCH (a:A:B:C) RETURN a")
+ val result = executeWithAllPlannersAndCompatibilityMode(s"MATCH (a:A:B:C) RETURN a")
// THEN
result.toList should equal (List(Map("a" -> n)))
@@ -851,7 +851,7 @@ return b
createLabeledNode("Foo")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(s"MATCH (n) RETURN (n:Foo)")
+ val result = executeWithAllPlannersAndCompatibilityMode(s"MATCH (n) RETURN (n:Foo)")
// THEN
result.toSet should equal (Set(Map("(n:Foo)" -> true), Map("(n:Foo)" -> false)))
@@ -896,7 +896,7 @@ return b
graph.createIndex("Person", "name")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name = 'Jacob' RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name = 'Jacob' RETURN n")
// then
result.toList should equal (List(Map("n" -> jake)))
@@ -945,7 +945,7 @@ return b
relate(jake, createNode())
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() WHERE n.name = 'Jacob' RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() WHERE n.name = 'Jacob' RETURN n")
// then
result.toList should equal (List(Map("n" -> jake)))
@@ -968,7 +968,7 @@ return b
relate(a, c)
// when asked for a cartesian product of the same match twice
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-->(b) match (c)-->(d) return a,b,c,d")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-->(b) match (c)-->(d) return a,b,c,d")
// then we should find 2 x 2 = 4 result matches
@@ -1031,7 +1031,7 @@ return b
graph.createIndex("Label", "property")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a:Label)-->(b:Label) where a.property = b.property return a, b")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a:Label)-->(b:Label) where a.property = b.property return a, b")
// then does not throw exceptions
result.toList should equal (List(Map("a" -> a, "b" -> b)))
@@ -1176,7 +1176,7 @@ return b
relate(b, c, "B")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-[r1:A]->(x)-[r2:B]->(a) return a.name")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-[r1:A]->(x)-[r2:B]->(a) return a.name")
// then does not throw exceptions
assert(result.toList === List(
@@ -1194,7 +1194,7 @@ return b
relate(b, c, "B")
// when
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a)-[:A]->(b), (b)-[:B]->(a) return a.name")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a)-[:A]->(b), (b)-[:B]->(a) return a.name")
// then does not throw exceptions
assert(result.toList === List(
@@ -1675,7 +1675,7 @@ return b
//WHEN
val first = updateWithBothPlannersAndCompatibilityMode(query).length
val second = updateWithBothPlannersAndCompatibilityMode(query).length
- val check = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (f:Folder) RETURN f.name").toSet
+ val check = executeWithAllPlannersAndCompatibilityMode("MATCH (f:Folder) RETURN f.name").toSet
//THEN
first should equal(second)
@@ -1708,7 +1708,7 @@ return b
val first = updateWithBothPlannersAndCompatibilityMode(query).length
val second = updateWithBothPlannersAndCompatibilityMode(query).length
- val check = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (f:Folder) RETURN f.name").toSet
+ val check = executeWithAllPlannersAndCompatibilityMode("MATCH (f:Folder) RETURN f.name").toSet
//THEN
first should equal(second)
@@ -1878,7 +1878,7 @@ return b
val query = "MATCH (a) RETURN a.bar"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toList
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toList
result should equal(List(Map("a.bar" -> null)))
}
@@ -1888,7 +1888,7 @@ return b
val query = "MATCH (a) RETURN a.prop"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(asResult(props, "a")))
}
@@ -1897,7 +1897,7 @@ return b
val query = "MATCH (a)-[r]->(b) RETURN r.prop"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(asResult(Map("prop" -> 1), "r")))
}
@@ -1907,7 +1907,7 @@ return b
val query = "MATCH (a)-[r]->(b) RETURN a.nodeProp, r.relProp"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(asResult(Map("nodeProp" -> 1), "a") ++ asResult(Map("relProp" -> 2), "r")))
}
@@ -1917,7 +1917,7 @@ return b
val query = "MATCH (a)-[r]->(b) RETURN a AS FOO, r AS BAR"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(Map("FOO" -> a, "BAR" -> r)))
}
@@ -1926,7 +1926,7 @@ return b
val query = "MATCH (a)-[r]->(b) RETURN r.foo"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(Map("r.foo" -> null)))
}
@@ -1940,14 +1940,14 @@ return b
val query = "MATCH (a) RETURN a.name, a.age, a.seasons"
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode(query).toComparableResult
result should equal(List(asResult(props, "a")))
}
test("adding a property and a literal is supported in new runtime") {
val props = Map("prop" -> 1)
createNode(props)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a) RETURN a.prop + 1 AS FOO").toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a) RETURN a.prop + 1 AS FOO").toComparableResult
result should equal(List(Map("FOO" -> 2)))
}
@@ -1955,7 +1955,7 @@ return b
test("adding arrays is supported in new runtime") {
val props = Map("prop1" -> Array(1,2,3), "prop2" -> Array(4, 5))
createNode(props)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a) RETURN a.prop1 + a.prop2 AS FOO").toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a) RETURN a.prop1 + a.prop2 AS FOO").toComparableResult
result should equal(List(Map("FOO" -> List(1, 2, 3, 4, 5))))
}
@@ -2007,7 +2007,7 @@ return b
val node1 = createNode()
val node2 = createNode()
val rel = relate(node1, node2)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n)-[r]->(m) return [n, r, m] as r").toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n)-[r]->(m) return [n, r, m] as r").toComparableResult
result should equal(Seq(Map("r" -> Seq(node1, rel, node2))))
}
@@ -2016,7 +2016,7 @@ return b
val node1 = createNode()
val node2 = createNode()
val rel = relate(node1, node2)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n)-[r]->(m) return {node1: n, rel: r, node2: m} as m").toComparableResult
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n)-[r]->(m) return {node1: n, rel: r, node2: m} as m").toComparableResult
result should equal(Seq(Map("m" -> Map("node1" -> node1, "rel" -> rel, "node2" -> node2))))
}
@@ -2081,7 +2081,7 @@ return b
}
test("columns should be in the provided order") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (p),(o),(n),(t),(u),(s) RETURN p,o,n,t,u,s")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (p),(o),(n),(t),(u),(s) RETURN p,o,n,t,u,s")
result.columns should equal(List("p", "o", "n", "t", "u", "s"))
}
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/OptionalMatchAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/OptionalMatchAcceptanceTest.scala
index 3bcaf84893019..75a7544aeb795 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/OptionalMatchAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/OptionalMatchAcceptanceTest.scala
@@ -19,7 +19,7 @@
*/
package org.neo4j.internal.cypher.acceptance
-import org.neo4j.cypher.{NewPlannerTestSupport, ExecutionEngineFunSuite}
+import org.neo4j.cypher.{ExecutionEngineFunSuite, NewPlannerTestSupport}
import org.neo4j.graphdb._
class OptionalMatchAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSupport {
@@ -52,12 +52,12 @@ class OptionalMatchAcceptanceTest extends ExecutionEngineFunSuite with NewPlanne
}
test("predicates on optional matches should be respected") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n:Single) optional match (n)-[r]-(m) where m.prop = 42 return m")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n:Single) optional match (n)-[r]-(m) where m.prop = 42 return m")
assert(result.toList === List(Map("m" -> nodeA)))
}
test("has label on null should evaluate to null") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n:Single) optional match (n)-[r:TYPE]-(m) return m:TYPE")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n:Single) optional match (n)-[r:TYPE]-(m) return m:TYPE")
assert(result.toList === List(Map("m:TYPE" -> null)))
}
@@ -84,7 +84,7 @@ class OptionalMatchAcceptanceTest extends ExecutionEngineFunSuite with NewPlanne
}
test("optional matching between two found nodes behaves as expected") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(
+ val result = executeWithAllPlannersAndCompatibilityMode(
"""match (a:A), (b:C)
|optional match (x)-->(b)
|return x""".stripMargin)
@@ -103,7 +103,7 @@ class OptionalMatchAcceptanceTest extends ExecutionEngineFunSuite with NewPlanne
relate(x2, b1)
relate(x2, b2)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (a:X) OPTIONAL MATCH (a)-->(b:Y) RETURN b")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (a:X) OPTIONAL MATCH (a)-->(b:Y) RETURN b")
result.toSet should equal(Set(Map("b" -> null), Map("b" -> b1), Map("b" -> b2)))
}
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/ReturnAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/ReturnAcceptanceTest.scala
index 9469ec7fd154a..2bf09ba4d53be 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/ReturnAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/ReturnAcceptanceTest.scala
@@ -78,7 +78,7 @@ class ReturnAcceptanceTest extends ExecutionEngineFunSuite with CustomMatchers w
createNode()
createNode()
createNode()
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n) return n limit 0")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n) return n limit 0")
result should be(empty)
}
@@ -139,7 +139,7 @@ order by a.age""").toList)
}
test("long or double") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("return 1, 1.5").toList.head
+ val result = executeWithAllPlannersAndCompatibilityMode("return 1, 1.5").toList.head
result("1") should haveType[java.lang.Long]
result("1.5") should haveType[java.lang.Double]
@@ -240,13 +240,13 @@ order by a.age""").toList)
test("array prop output") {
createNode("foo" -> Array(1, 2, 3))
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n) return n").dumpToString()
+ val result = executeWithAllPlannersAndCompatibilityMode("match (n) return n").dumpToString()
result should include ("[1,2,3]")
}
test("map output") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("return {a:1, b:'foo'}").dumpToString()
+ val result = executeWithAllPlannersAndCompatibilityMode("return {a:1, b:'foo'}").dumpToString()
result should ( include ("""{a -> 1, b -> "foo"}""") or include ("""{b -> "foo", a -> 1}""") )
}
@@ -323,7 +323,7 @@ order by a.age""").toList)
}
test("allow queries with only return") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("RETURN 'Andres'").toList
+ val result = executeWithAllPlannersAndCompatibilityMode("RETURN 'Andres'").toList
result should equal(List(Map("'Andres'" -> "Andres")))
}
@@ -348,7 +348,7 @@ order by a.age""").toList)
test("should be able to alias expressions") {
createNode("id" -> 42)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (a) return a.id as a, a.id")
+ val result = executeWithAllPlannersAndCompatibilityMode("match (a) return a.id as a, a.id")
result.toList should equal(List(Map("a" -> 42, "a.id" -> 42)))
}
@@ -397,19 +397,19 @@ order by a.age""").toList)
}
test("compiled runtime should support literal expressions") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("RETURN 1")
+ val result = executeWithAllPlannersAndCompatibilityMode("RETURN 1")
result.toList should equal(List(Map("1" -> 1)))
}
test("compiled runtime should support addition of collections") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("RETURN [1,2,3] + [4, 5] AS FOO")
+ val result = executeWithAllPlannersAndCompatibilityMode("RETURN [1,2,3] + [4, 5] AS FOO")
result.toComparableResult should equal(List(Map("FOO" -> List(1, 2, 3, 4, 5))))
}
test("compiled runtime should support addition of item to collection") {
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("""RETURN [1,2,3] + 4 AS FOO""")
+ val result = executeWithAllPlannersAndCompatibilityMode("""RETURN [1,2,3] + 4 AS FOO""")
result.toComparableResult should equal(List(Map("FOO" -> List(1, 2, 3, 4))))
}
@@ -417,7 +417,7 @@ order by a.age""").toList)
test("Should return correct scala objects") {
val query = "RETURN {uid: 'foo'} AS params"
- val rows = executeWithAllPlannersAndRuntimesAndCompatibilityMode(query).columnAs[Map[String, Any]]("params").toList
+ val rows = executeWithAllPlannersAndCompatibilityMode(query).columnAs[Map[String, Any]]("params").toList
rows.head should equal(Map("uid" -> "foo"))
}
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UniqueIndexAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UniqueIndexAcceptanceTest.scala
index 45c78802d5065..b387bd8258966 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UniqueIndexAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UniqueIndexAcceptanceTest.scala
@@ -33,7 +33,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob'] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob'] RETURN n")
//THEN
result.toList should equal (List(Map("n" -> jake)))
@@ -49,7 +49,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob','Jacob'] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob','Jacob'] RETURN n")
//THEN
result.toList should equal (List(Map("n" -> jake)))
@@ -65,7 +65,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN [] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN [] RETURN n")
//THEN
result.toList should equal (List())
@@ -81,7 +81,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN null RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN null RETURN n")
//THEN
result.toList should equal (List())
@@ -97,7 +97,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n","coll"->List("Jacob"))
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n","coll"->List("Jacob"))
//THEN
result.toList should equal (List(Map("n" -> jake)))
@@ -113,7 +113,7 @@ class UniqueIndexAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerT
graph.createConstraint("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n","coll"->List("Jacob"))
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n","coll"->List("Jacob"))
//THEN
result should use("NodeUniqueIndexSeek")
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UsingAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UsingAcceptanceTest.scala
index 992f7e6f8bdca..67577405263a7 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UsingAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/UsingAcceptanceTest.scala
@@ -78,7 +78,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
}
test("scan hints are handled by ronja") {
- executeWithAllPlannersAndRuntimesAndCompatibilityMode("match (n:Person) using scan n:Person return n").toList
+ executeWithAllPlannersAndCompatibilityMode("match (n:Person) using scan n:Person return n").toList
}
test("fail when equality checks are done with OR") {
@@ -178,7 +178,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
graph.createIndex("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob'] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob'] RETURN n")
//THEN
result.toList should equal(List(Map("n" -> jake)))
@@ -194,7 +194,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
graph.createIndex("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob','Jacob'] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN ['Jacob','Jacob'] RETURN n")
//THEN
result.toList should equal(List(Map("n" -> jake)))
@@ -210,7 +210,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
graph.createIndex("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN [] RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN [] RETURN n")
//THEN
result.toList should equal(List())
@@ -226,7 +226,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
graph.createIndex("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN null RETURN n")
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN null RETURN n")
//THEN
result.toList should equal(List())
@@ -242,7 +242,7 @@ class UsingAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSup
graph.createIndex("Person", "name")
//WHEN
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n", "coll" -> List("Jacob"))
+ val result = executeWithAllPlannersAndCompatibilityMode("MATCH (n:Person)-->() USING INDEX n:Person(name) WHERE n.name IN {coll} RETURN n", "coll" -> List("Jacob"))
//THEN
result.toList should equal(List(Map("n" -> jake)))
diff --git a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/WithAcceptanceTest.scala b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/WithAcceptanceTest.scala
index b25b01a60e4b8..5863e5065cc06 100644
--- a/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/WithAcceptanceTest.scala
+++ b/community/cypher/acceptance/src/test/scala/org/neo4j/internal/cypher/acceptance/WithAcceptanceTest.scala
@@ -28,7 +28,7 @@ class WithAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSupp
val b = createNode()
relate(a, b)
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(
+ val result = executeWithAllPlannersAndCompatibilityMode(
"MATCH (a) WITH a MATCH (a)-->(b) RETURN *"
)
result.toList should equal(List(Map("a" -> a, "b" -> b)))
@@ -51,7 +51,7 @@ class WithAcceptanceTest extends ExecutionEngineFunSuite with NewPlannerTestSupp
val a = createNode()
val b = createNode()
- val result = executeWithAllPlannersAndRuntimesAndCompatibilityMode(
+ val result = executeWithAllPlannersAndCompatibilityMode(
"MATCH (a) WITH a MATCH (b) RETURN *"
)
result.toSet should equal(Set(
diff --git a/community/cypher/compatibility-suite/src/test/java/cypher/FeatureSuiteTest.java b/community/cypher/compatibility-suite/src/test/java/cypher/FeatureSuiteTest.java
index 33dc97ede8693..610be67d9b411 100644
--- a/community/cypher/compatibility-suite/src/test/java/cypher/FeatureSuiteTest.java
+++ b/community/cypher/compatibility-suite/src/test/java/cypher/FeatureSuiteTest.java
@@ -48,16 +48,4 @@ public static class RuleInterpreted
public static class CostInterpreted
{
}
-
- // The compiled runtime is not officially supported, and it fails on running these tests
-// @RunWith( Cucumber.class )
-// @CucumberOptions( plugin = {
-// "pretty", "html:target/cost-compiled",
-// "cypher.cucumber.reporter.CypherResultReporter:target/cost-compiled",
-// "cypher.cucumber.db.DatabaseProvider:target/dbs",
-// "cypher.cucumber.db.DatabaseConfigProvider:/cypher/db/config/cost-compiled.json",
-// } )
-// public static class CostCompiled
-// {
-// }
}
diff --git a/community/cypher/compatibility-suite/src/test/resources/cypher/db/config/cost-compiled.json b/community/cypher/compatibility-suite/src/test/resources/cypher/db/config/cost-compiled.json
deleted file mode 100644
index 15c5341800dd8..0000000000000
--- a/community/cypher/compatibility-suite/src/test/resources/cypher/db/config/cost-compiled.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "planner" : "cost",
- "runtime" : "compiled"
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImpl.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/ResultRowImpl.java
similarity index 98%
rename from community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImpl.java
rename to community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/ResultRowImpl.java
index 4ddb58897fe2e..1bdc973b61bfd 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImpl.java
+++ b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/ResultRowImpl.java
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.neo4j.cypher.internal.compiler.v3_0.codegen;
+package org.neo4j.cypher.internal.compiler.v3_0;
import java.util.HashMap;
import java.util.Map;
@@ -109,3 +109,4 @@ private T get( String key, Class type )
}
}
+
diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionTracer.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionTracer.java
deleted file mode 100644
index 621618403b1e4..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionTracer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen;
-
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.Id;
-
-public interface QueryExecutionTracer
-{
- QueryExecutionEvent executeOperator( Id queryId );
-
- QueryExecutionTracer NONE = new QueryExecutionTracer()
- {
- @Override
- public QueryExecutionEvent executeOperator( Id queryId )
- {
- return QueryExecutionEvent.NONE;
- }
- };
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracer.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracer.java
deleted file mode 100644
index dcdb3a6fa6a76..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionEvent;
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer;
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.Id;
-
-public class ProfilingTracer implements QueryExecutionTracer
-{
- public interface ProfilingInformation
- {
- long time();
- long dbHits();
- long rows();
- }
-
- public interface Clock
- {
- long nanoTime();
-
- Clock SYSTEM_TIMER = new Clock()
- {
- @Override
- public long nanoTime()
- {
- return System.nanoTime();
- }
- };
- }
-
- private static final Data ZERO = new Data();
-
- private final Clock clock;
- private final Map data = new HashMap<>();
-
- public ProfilingTracer()
- {
- this( Clock.SYSTEM_TIMER );
- }
-
- ProfilingTracer( Clock clock )
- {
- this.clock = clock;
- }
-
- public ProfilingInformation get( Id query )
- {
- Data value = data.get( query );
- return value == null ? ZERO : value;
- }
-
- public long timeOf( Id query )
- {
- return get( query ).time();
- }
-
- public long dbHitsOf( Id query )
- {
- return get( query ).dbHits();
- }
-
- public long rowsOf( Id query )
- {
- return get( query ).rows();
- }
-
- @Override
- public QueryExecutionEvent executeOperator( Id queryId )
- {
- Data data = this.data.get( queryId );
- if ( data == null && queryId != null )
- {
- this.data.put( queryId, data = new Data() );
- }
- return new ExecutionEvent( clock, data );
- }
-
- private static class ExecutionEvent implements QueryExecutionEvent
- {
- private final long start;
- private final Clock clock;
- private final Data data;
- private long hitCount;
- private long rowCount;
-
- public ExecutionEvent( Clock clock, Data data )
- {
- this.clock = clock;
- this.data = data;
- this.start = clock.nanoTime();
- }
-
- @Override
- public void close()
- {
- long executionTime = clock.nanoTime() - start;
- if ( data != null )
- {
- data.update( executionTime, hitCount, rowCount );
- }
- }
-
- @Override
- public void dbHit()
- {
- hitCount++;
- }
-
- @Override
- public void row()
- {
- rowCount++;
- }
- }
-
- private static class Data implements ProfilingInformation
- {
- private long time, hits, rows;
-
- public void update( long time, long hits, long rows )
- {
- this.time += time;
- this.hits += hits;
- this.rows += rows;
- }
-
- @Override
- public long time()
- {
- return time;
- }
-
- @Override
- public long dbHits()
- {
- return hits;
- }
-
- @Override
- public long rows()
- {
- return rows;
- }
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java
deleted file mode 100644
index 0bb40336c941b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.executionplan;
-
-import java.util.Map;
-
-import org.neo4j.cypher.internal.compiler.v3_0.ExecutionMode;
-import org.neo4j.cypher.internal.compiler.v3_0.TaskCloser;
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer;
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription;
-import org.neo4j.cypher.internal.compiler.v3_0.spi.QueryContext;
-
-public interface GeneratedQuery
-{
- GeneratedQueryExecution execute(
- TaskCloser closer,
- QueryContext queryContext,
- ExecutionMode executionMode,
- Provider description,
- QueryExecutionTracer tracer,
- Map params );
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQueryExecution.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQueryExecution.java
deleted file mode 100644
index da5d97e45693b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQueryExecution.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.executionplan;
-
-import java.util.List;
-
-import org.neo4j.cypher.internal.compiler.v3_0.ExecutionMode;
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription;
-import org.neo4j.cypher.internal.compiler.v3_0.spi.InternalResultVisitor;
-
-public interface GeneratedQueryExecution
-{
- List javaColumns();
-
- void accept( final InternalResultVisitor visitor ) throws E;
-
- ExecutionMode executionMode();
-
- InternalPlanDescription executionPlanDescription();
-
- void setSuccessfulCloseable( SuccessfulCloseable closeable );
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/CypherCompiler.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/CypherCompiler.scala
index 94f6debcb7fdc..8ba740be19e2e 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/CypherCompiler.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/CypherCompiler.scala
@@ -23,7 +23,6 @@ import java.time.Clock
import org.neo4j.cypher.internal.compiler.v3_0.CompilationPhaseTracer.CompilationPhase.{AST_REWRITE, PARSING, SEMANTIC_CHECK}
import org.neo4j.cypher.internal.compiler.v3_0.ast.rewriters.{normalizeReturnClauses, normalizeWithClauses}
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.CodeStructure
import org.neo4j.cypher.internal.compiler.v3_0.executionplan._
import org.neo4j.cypher.internal.compiler.v3_0.executionplan.procs.DelegatingProcedureExecutablePlanBuilder
import org.neo4j.cypher.internal.compiler.v3_0.helpers.closing
@@ -72,7 +71,7 @@ case class CypherCompilerConfiguration(queryCacheSize: Int,
object CypherCompilerFactory {
val monitorTag = "cypher3.0"
- def costBasedCompiler(graph: GraphDatabaseQueryService, config: CypherCompilerConfiguration, clock: Clock, structure: CodeStructure[GeneratedQuery],
+ def costBasedCompiler(graph: GraphDatabaseQueryService, config: CypherCompilerConfiguration, clock: Clock,
monitors: Monitors, logger: InfoLogger,
rewriterSequencer: (String) => RewriterStepSequencer,
plannerName: Option[CostBasedPlannerName],
@@ -86,11 +85,10 @@ object CypherCompilerFactory {
val metricsFactory = CachedMetricsFactory(SimpleMetricsFactory)
val queryPlanner = new DefaultQueryPlanner(LogicalPlanRewriter(rewriterSequencer))
- val compiledPlanBuilder = CompiledPlanBuilder(clock, structure)
val interpretedPlanBuilder = InterpretedPlanBuilder(clock, monitors, publicTypeConverter)
// Pick runtime based on input
- val runtimeBuilder = RuntimeBuilder.create(runtimeName, interpretedPlanBuilder, compiledPlanBuilder, config.useErrorsOverWarnings)
+ val runtimeBuilder = RuntimeBuilder.create(runtimeName, interpretedPlanBuilder)
val costPlanProducer = CostBasedPipeBuilderFactory.create(
monitors = monitors,
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeBuilder.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeBuilder.scala
index 9304db9dc3c4b..8abb8fceb42a1 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeBuilder.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeBuilder.scala
@@ -22,96 +22,50 @@ package org.neo4j.cypher.internal.compiler.v3_0
import java.time.Clock
import org.neo4j.cypher.internal.compiler.v3_0.CompilationPhaseTracer.CompilationPhase._
-import org.neo4j.cypher.internal.compiler.v3_0.CompiledPlanBuilder.createTracer
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling.ProfilingTracer
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenerator, CodeStructure}
-import org.neo4j.cypher.internal.compiler.v3_0.executionplan.ExecutionPlanBuilder.DescriptionProvider
import org.neo4j.cypher.internal.compiler.v3_0.executionplan.InterpretedExecutionPlanBuilder.interpretedToExecutionPlan
-import org.neo4j.cypher.internal.compiler.v3_0.executionplan.{ExecutionPlan, GeneratedQuery, InternalExecutionResult, NewRuntimeSuccessRateMonitor, PlanFingerprint, PlanFingerprintReference, Provider, READ_ONLY}
+import org.neo4j.cypher.internal.compiler.v3_0.executionplan.{ExecutionPlan, NewRuntimeSuccessRateMonitor, PlanFingerprint, PlanFingerprintReference}
import org.neo4j.cypher.internal.compiler.v3_0.helpers._
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription.Arguments
+import org.neo4j.cypher.internal.compiler.v3_0.planner.PeriodicCommit
import org.neo4j.cypher.internal.compiler.v3_0.planner.execution.{PipeExecutionBuilderContext, PipeExecutionPlanBuilder}
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans.LogicalPlan
-import org.neo4j.cypher.internal.compiler.v3_0.planner.{CantCompileQueryException, PeriodicCommit}
-import org.neo4j.cypher.internal.compiler.v3_0.spi.{GraphStatistics, PlanContext, QueryContext}
-import org.neo4j.cypher.internal.frontend.v3_0.notification.{InternalNotification, RuntimeUnsupportedNotification}
-import org.neo4j.cypher.internal.frontend.v3_0.{InternalException, InvalidArgumentException, SemanticTable}
+import org.neo4j.cypher.internal.compiler.v3_0.spi.PlanContext
+import org.neo4j.cypher.internal.frontend.v3_0.SemanticTable
object RuntimeBuilder {
- def create(runtimeName: Option[RuntimeName], interpretedProducer: InterpretedPlanBuilder,
- compiledProducer: CompiledPlanBuilder, useErrorsOverWarnings: Boolean) = runtimeName match {
- case None | Some(InterpretedRuntimeName) => InterpretedRuntimeBuilder(interpretedProducer)
- case Some(CompiledRuntimeName) if useErrorsOverWarnings => ErrorReportingRuntimeBuilder(compiledProducer)
- case Some(CompiledRuntimeName) => WarningFallbackRuntimeBuilder(interpretedProducer, compiledProducer)
- }
+
+ def create(runtimeName: Option[RuntimeName], interpretedProducer: InterpretedPlanBuilder) = InterpretedRuntimeBuilder(
+ interpretedProducer)
}
+
trait RuntimeBuilder {
- def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan, pipeBuildContext: PipeExecutionBuilderContext,
+ def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan,
+ pipeBuildContext: PipeExecutionBuilderContext,
planContext: PlanContext, tracer: CompilationPhaseTracer, semanticTable: SemanticTable,
monitor: NewRuntimeSuccessRateMonitor, plannerName: PlannerName,
preparedQuery: PreparedQuerySemantics,
createFingerprintReference: Option[PlanFingerprint] => PlanFingerprintReference,
- config: CypherCompilerConfiguration): ExecutionPlan = {
- try {
- compiledProducer(logicalPlan, semanticTable, planContext, monitor, tracer,
- plannerName, preparedQuery, createFingerprintReference)
- } catch {
- case e: CantCompileQueryException =>
- monitor.unableToHandlePlan(logicalPlan, e)
- fallback(preparedQuery)
- interpretedProducer
- .apply(periodicCommit, logicalPlan, pipeBuildContext, planContext, tracer, preparedQuery, createFingerprintReference, config)
- }
- }
-
- def compiledProducer: CompiledPlanBuilder
-
- def interpretedProducer: InterpretedPlanBuilder
-
- def fallback(preparedQuery: PreparedQuerySemantics): Unit
-}
-
-case class SilentFallbackRuntimeBuilder(interpretedProducer: InterpretedPlanBuilder, compiledProducer: CompiledPlanBuilder)
- extends RuntimeBuilder {
-
- override def fallback(preparedQuery: PreparedQuerySemantics): Unit = {}
-}
-
-case class WarningFallbackRuntimeBuilder(interpretedProducer: InterpretedPlanBuilder, compiledProducer: CompiledPlanBuilder)
- extends RuntimeBuilder {
-
- override def fallback(preparedQuery: PreparedQuerySemantics): Unit = preparedQuery.notificationLogger
- .log(RuntimeUnsupportedNotification)
+ config: CypherCompilerConfiguration): ExecutionPlan
}
case class InterpretedRuntimeBuilder(interpretedProducer: InterpretedPlanBuilder) extends RuntimeBuilder {
- override def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan, pipeBuildContext: PipeExecutionBuilderContext,
+
+ override def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan,
+ pipeBuildContext: PipeExecutionBuilderContext,
planContext: PlanContext, tracer: CompilationPhaseTracer, semanticTable: SemanticTable,
monitor: NewRuntimeSuccessRateMonitor, plannerName: PlannerName,
preparedQuery: PreparedQuerySemantics,
createFingerprintReference: Option[PlanFingerprint] => PlanFingerprintReference,
config: CypherCompilerConfiguration): ExecutionPlan =
- interpretedProducer(periodicCommit, logicalPlan, pipeBuildContext, planContext, tracer, preparedQuery, createFingerprintReference, config)
-
-
- override def compiledProducer = throw new InternalException("This should never be called")
-
- override def fallback(preparedQuery: PreparedQuerySemantics) = throw new InternalException("This should never be called")
-}
-
-case class ErrorReportingRuntimeBuilder(compiledProducer: CompiledPlanBuilder) extends RuntimeBuilder {
+ interpretedProducer(periodicCommit, logicalPlan, pipeBuildContext, planContext, tracer, preparedQuery,
+ createFingerprintReference, config)
- override def interpretedProducer = throw new InternalException("This should never be called")
-
- override def fallback(preparedQuery: PreparedQuerySemantics) = throw new
- InvalidArgumentException("The given query is not currently supported in the selected runtime")
}
case class InterpretedPlanBuilder(clock: Clock, monitors: Monitors, publicTypeConverter: Any => Any) {
- def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan, pipeBuildContext: PipeExecutionBuilderContext,
+ def apply(periodicCommit: Option[PeriodicCommit], logicalPlan: LogicalPlan,
+ pipeBuildContext: PipeExecutionBuilderContext,
planContext: PlanContext, tracer: CompilationPhaseTracer, preparedQuery: PreparedQuerySemantics,
createFingerprintReference: Option[PlanFingerprint] => PlanFingerprintReference,
config: CypherCompilerConfiguration) =
@@ -121,74 +75,3 @@ case class InterpretedPlanBuilder(clock: Clock, monitors: Monitors, publicTypeCo
planContext, preparedQuery, createFingerprintReference, config, publicTypeConverter)
}
}
-
-case class CompiledPlanBuilder(clock: Clock, structure:CodeStructure[GeneratedQuery]) {
-
- private val codeGen = new CodeGenerator(structure)
-
- def apply(logicalPlan: LogicalPlan, semanticTable: SemanticTable, planContext: PlanContext,
- monitor: NewRuntimeSuccessRateMonitor, tracer: CompilationPhaseTracer,
- plannerName: PlannerName,
- preparedQuery: PreparedQuerySemantics,
- createFingerprintReference:Option[PlanFingerprint]=>PlanFingerprintReference): ExecutionPlan = {
- monitor.newPlanSeen(logicalPlan)
- closing(tracer.beginPhase(CODE_GENERATION)) {
- val compiled = codeGen.generate(logicalPlan, planContext, clock, semanticTable, plannerName)
-
- new ExecutionPlan {
- val fingerprint = createFingerprintReference(compiled.fingerprint)
-
- def isStale(lastTxId: () => Long, statistics: GraphStatistics) = fingerprint.isStale(lastTxId, statistics)
-
- def run(queryContext: QueryContext,
- executionMode: ExecutionMode, params: Map[String, Any]): InternalExecutionResult = {
- val taskCloser = new TaskCloser
- taskCloser.addTask(queryContext.transactionalContext.close)
- try {
- if (executionMode == ExplainMode) {
- //close all statements
- taskCloser.close(success = true)
- new ExplainExecutionResult(compiled.columns.toList,
- compiled.planDescription, READ_ONLY, preparedQuery.notificationLogger.notifications)
- } else
- compiled.executionResultBuilder(queryContext, executionMode, createTracer(executionMode), params, taskCloser)
- } catch {
- case (t: Throwable) =>
- taskCloser.close(success = false)
- throw t
- }
- }
-
- def plannerUsed: PlannerName = compiled.plannerUsed
-
- def isPeriodicCommit: Boolean = compiled.periodicCommit.isDefined
-
- def runtimeUsed = CompiledRuntimeName
-
- override def notifications(planContext: PlanContext): Seq[InternalNotification] = Seq.empty
- }
- }
- }
-}
-
-object CompiledPlanBuilder {
-
- def createTracer( mode: ExecutionMode ) : DescriptionProvider = mode match {
- case ProfileMode =>
- val tracer = new ProfilingTracer()
- (description: InternalPlanDescription) => (new Provider[InternalPlanDescription] {
-
- override def get(): InternalPlanDescription = description.map {
- plan: InternalPlanDescription =>
- val data = tracer.get(plan.id)
- plan.
- addArgument(Arguments.DbHits(data.dbHits())).
- addArgument(Arguments.Rows(data.rows())).
- addArgument(Arguments.Time(data.time()))
- }
- }, Some(tracer))
- case _ => (description: InternalPlanDescription) => (new Provider[InternalPlanDescription] {
- override def get(): InternalPlanDescription = description
- }, None)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeName.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeName.scala
index 228204f865fc3..88f3e98b27e96 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeName.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/RuntimeName.scala
@@ -28,10 +28,6 @@ case object InterpretedRuntimeName extends RuntimeName {
override val name = "INTERPRETED"
}
-case object CompiledRuntimeName extends RuntimeName {
- override val name = "COMPILED"
-}
-
case object ProcedureRuntimeName extends RuntimeName {
override val name = "PROCEDURE"
}
@@ -40,9 +36,8 @@ object RuntimeName {
def apply(name: String): RuntimeName = name.toUpperCase match {
case InterpretedRuntimeName.name => InterpretedRuntimeName
- case CompiledRuntimeName.name => CompiledRuntimeName
case n => throw new IllegalArgumentException(
- s"$n is not a valid runtime, valid options are ${InterpretedRuntimeName.name} and ${CompiledRuntimeName.name}")
+ s"$n is not a valid runtime, valid option is ${InterpretedRuntimeName.name}}")
}
}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenContext.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenContext.scala
deleted file mode 100644
index 729a1104783ad..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenContext.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.JoinData
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.Id
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans.LogicalPlan
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.CypherType
-import org.neo4j.cypher.internal.frontend.v3_0.SemanticTable
-
-import scala.collection.mutable
-
-case class Variable(name: String, cypherType: CypherType, nullable: Boolean = false)
-
-class CodeGenContext(val semanticTable: SemanticTable, idMap: Map[LogicalPlan, Id], val namer: Namer = Namer()) {
-
- private val variables: mutable.Map[String, Variable] = mutable.Map()
- private val probeTables: mutable.Map[CodeGenPlan, JoinData] = mutable.Map()
- private val parents: mutable.Stack[CodeGenPlan] = mutable.Stack()
- val operatorIds: mutable.Map[Id, String] = mutable.Map()
-
- def addVariable(queryVariable: String, variable: Variable) {
- variables.put(queryVariable, variable)
- }
-
- def getVariable(queryVariable: String): Variable = variables(queryVariable)
-
- def variableQueryVariables(): Set[String] = variables.keySet.toSet
-
- def addProbeTable(plan: CodeGenPlan, codeThunk: JoinData) {
- probeTables.put(plan, codeThunk)
- }
-
- def getProbeTable(plan: CodeGenPlan): JoinData = probeTables(plan)
-
- def pushParent(plan: CodeGenPlan) {
- if (plan.isInstanceOf[LeafCodeGenPlan]) {
- throw new IllegalArgumentException(s"Leafs can't be parents: $plan")
- }
- parents.push(plan)
- }
-
- def popParent(): CodeGenPlan = parents.pop()
-
- def registerOperator(plan: LogicalPlan): String = {
- operatorIds.getOrElseUpdate(idMap(plan), namer.newOpName(plan.getClass.getSimpleName))
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenPlan.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenPlan.scala
deleted file mode 100644
index bf125bc8dd3ca..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenPlan.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.Instruction
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans.LogicalPlan
-
-trait CodeGenPlan {
-
- val logicalPlan: LogicalPlan
-
- def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction])
-
- def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction)
-}
-
-trait LeafCodeGenPlan extends CodeGenPlan {
-
- override final def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) =
- throw new UnsupportedOperationException("Leaf plan does not consume")
-}
-
-case class JoinTableMethod(name: String, tableType: JoinTableType)
-
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala
deleted file mode 100644
index 235f8ca4c7e01..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import java.lang.Boolean.getBoolean
-import java.time.Clock
-import java.util
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.CodeGenerator.SourceSink
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir._
-import org.neo4j.cypher.internal.compiler.v3_0.executionplan.ExecutionPlanBuilder.DescriptionProvider
-import org.neo4j.cypher.internal.compiler.v3_0.executionplan.{CompiledPlan, PlanFingerprint, _}
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription.Arguments.SourceCode
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.{Id, InternalPlanDescription}
-import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans._
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.{LogicalPlan2PlanDescription, LogicalPlanIdentificationBuilder}
-import org.neo4j.cypher.internal.compiler.v3_0.spi.{InstrumentedGraphStatistics, PlanContext, QueryContext}
-import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, PlannerName, TaskCloser}
-import org.neo4j.cypher.internal.frontend.v3_0.SemanticTable
-import org.neo4j.cypher.internal.frontend.v3_0.helpers.Eagerly
-
-class CodeGenerator(val structure: CodeStructure[GeneratedQuery]) {
-
- import CodeGenerator.generateCode
-
- type PlanDescriptionProvider =
- (InternalPlanDescription) => (Provider[InternalPlanDescription], Option[QueryExecutionTracer])
-
- def generate(plan: LogicalPlan, planContext: PlanContext, clock: Clock, semanticTable: SemanticTable, plannerName: PlannerName) = {
- plan match {
- case res: ProduceResult =>
- val idMap = LogicalPlanIdentificationBuilder(plan)
-
- var sources = Map.empty[String, String]
- val sourceSink: SourceSink = if(getBoolean("org.neo4j.cypher.internal.codegen.IncludeSourcesInPlanDescription")) Some(
- (className:String, sourceCode:String) => { sources = sources.updated(className, sourceCode) }) else None
-
- val query: GeneratedQuery = generateQuery(plan, semanticTable, idMap, res.columns, sourceSink)
-
- val fp = planContext.statistics match {
- case igs: InstrumentedGraphStatistics =>
- Some(PlanFingerprint(clock.millis(), planContext.txIdProvider(), igs.snapshot.freeze))
- case _ =>
- None
- }
-
- val description: InternalPlanDescription = sources.foldLeft(LogicalPlan2PlanDescription(plan, idMap)) {
- case (root, (className, sourceCode)) => root.addArgument(SourceCode(className, sourceCode))
- }
-
- val builder = new RunnablePlan {
- def apply(queryContext: QueryContext, execMode: ExecutionMode,
- descriptionProvider: DescriptionProvider, params: Map[String, Any],
- closer: TaskCloser): InternalExecutionResult = {
- val (provider, tracer) = descriptionProvider(description)
- val execution: GeneratedQueryExecution = query.execute(closer, queryContext, execMode,
- provider, tracer.getOrElse(QueryExecutionTracer.NONE), asJavaHashMap(params))
- new CompiledExecutionResult(closer, queryContext, execution, provider)
- }
- }
-
- CompiledPlan(updating = false, None, fp, plannerName, description, res.columns, builder)
-
- case _ => throw new CantCompileQueryException("Can only compile plans with ProduceResult on top")
- }
- }
-
- private def generateQuery(plan: LogicalPlan, semantics: SemanticTable, ids: Map[LogicalPlan, Id], columns: Seq[String], sources: SourceSink = None): GeneratedQuery = {
- import LogicalPlanConverter._
- implicit val context = new CodeGenContext(semantics, ids)
- val (_, instructions) = asCodeGenPlan(plan).produce(context)
- generateCode(structure)(instructions, context.operatorIds.map {
- case (id: Id, field: String) => field -> id
- }.toMap, columns, sources)
- }
-
- private def asJavaHashMap(params: scala.collection.Map[String, Any]) = {
- val jMap = new util.HashMap[String, Object]()
- params.foreach {
- case (key, value) => jMap.put(key, javaValue(value))
- }
- jMap
- }
-
- import scala.collection.JavaConverters._
- private def javaValue(value: Any): Object = value match {
- case null => null
- case iter: Seq[_] => iter.map(javaValue).asJava
- case iter: scala.collection.Map[_, _] => Eagerly.immutableMapValues(iter, javaValue).asJava
- case x: Any => x.asInstanceOf[AnyRef]
- }
-}
-
-object CodeGenerator {
- type SourceSink = Option[(String, String) => Unit]
-
- def generateCode[T](structure: CodeStructure[T])(instructions: Seq[Instruction], operatorIds: Map[String, Id], columns: Seq[String], sources:SourceSink=None)(implicit context: CodeGenContext): T = {
- structure.generateQuery(packageName, Namer.newClassName(), columns, operatorIds, sources) { accept =>
- instructions.foreach(insn => insn.init(accept))
- instructions.foreach(insn => insn.body(accept))
- }
- }
-
- private val packageName = "org.neo4j.cypher.internal.compiler.v3_0.generated"
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeStructure.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeStructure.scala
deleted file mode 100644
index 65a60507f59e5..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeStructure.scala
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.Id
-import org.neo4j.cypher.internal.frontend.v3_0.SemanticDirection
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.CypherType
-
-/**
- * This constitutes the SPI for code generation.
- */
-trait CodeStructure[T] {
- type SourceSink = (String, String) => Unit
- def generateQuery(packageName: String, className: String, columns: Seq[String], operatorIds: Map[String, Id], sourceSink: Option[SourceSink])
- (block: MethodStructure[_] => Unit)(implicit codeGenContext: CodeGenContext): T
-}
-
-sealed trait JoinTableType
-sealed trait CountingJoinTableType extends JoinTableType
-sealed trait RecordingJoinTableType extends JoinTableType
-
-case object LongToCountTable extends CountingJoinTableType
-case object LongsToCountTable extends CountingJoinTableType
-case class LongToListTable(structure: Map[String, CypherType], localMap: Map[String, String]) extends RecordingJoinTableType
-case class LongsToListTable(structure: Map[String, CypherType], localMap: Map[String, String]) extends RecordingJoinTableType
-
-trait MethodStructure[E] {
-
-
- // misc
- def projectVariable(variableName: String, value: E)
- def declareFlag(name: String, initialValue: Boolean)
- def updateFlag(name: String, newValue: Boolean)
- def declarePredicate(name: String): Unit
- def declare(varName: String, cypherType: CypherType): Unit
- def declareProperty(name: String): Unit
- def declareCounter(name: String, initialValue: E): Unit
- def putField(structure: Map[String, CypherType], value: E, fieldType: CypherType, fieldName: String, localVar: String): Unit
- def updateProbeTable(structure: Map[String, CypherType], tableVar: String, tableType: RecordingJoinTableType, keyVars: Seq[String], element: E): Unit
- def probe(tableVar: String, tableType: JoinTableType, keyVars: Seq[String])(block: MethodStructure[E]=>Unit): Unit
- def updateProbeTableCount(tableVar: String, tableType: CountingJoinTableType, keyVar: Seq[String]): Unit
- def allocateProbeTable(tableVar: String, tableType: JoinTableType): Unit
- def method(resultType: JoinTableType, resultVar: String, methodName: String)(block: MethodStructure[E]=>Unit): Unit
- def coerceToBoolean(propertyExpression: E): E
-
- // expressions
- def decreaseCounterAndCheckForZero(name: String): E
- def counterEqualsZero(variableName: String): E
- def newTableValue(targetVar: String, structure: Map[String, CypherType]): E
- def constant(value: Object): E
- def asMap(map: Map[String, E]): E
- def asList(values: Seq[E]): E
-
- def toSet(value: E): E
-
- def castToCollection(value: E): E
-
- def load(varName: String): E
-
- // arithmetic
- def add(lhs: E, rhs: E): E
- def sub(lhs: E, rhs: E): E
- def mul(lhs: E, rhs: E): E
- def div(lhs: E, rhs: E): E
- def mod(lhs: E, rhs: E): E
-
- // predicates
- def threeValuedNot(value: E): E
- def not(value: E): E
- def threeValuedEquals(lhs: E, rhs: E): E
- def eq(lhs: E, rhs: E): E
- def or(lhs: E, rhs: E): E
- def threeValuedOr(lhs: E, rhs: E): E
-
- // null handling
- def markAsNull(varName: String, cypherType: CypherType): Unit
- def nullable(varName: String, cypherType: CypherType, onSuccess: E): E
- def notNull(name: String, cypherType: CypherType): E
-
- // parameters
- def expectParameter(key: String, variableName: String): Unit
-
- // tracing
- def trace[V](planStepId: String)(block: MethodStructure[E] => V): V
- def incrementDbHits(): Unit
- def incrementRows(): Unit
-
- // db access
- def labelScan(iterVar: String, labelIdVar: String): Unit
- def hasLabel(nodeVar: String, labelVar: String, predVar: String): E
- def allNodesScan(iterVar: String): Unit
- def lookupLabelId(labelIdVar: String, labelName: String): Unit
- def lookupRelationshipTypeId(typeIdVar: String, typeName: String): Unit
- def nodeGetAllRelationships(iterVar: String, nodeVar: String, direction: SemanticDirection): Unit
- def nodeGetRelationships(iterVar: String, nodeVar: String, direction: SemanticDirection, typeVars: Seq[String]): Unit
- def connectingRelationships(iterVar: String, fromNode: String, dir: SemanticDirection, toNode:String)
- def connectingRelationships(iterVar: String, fromNode: String, dir: SemanticDirection, types: Seq[String], toNode: String)
- def nextNode(targetVar: String, iterVar: String): Unit
- def nextRelationshipAndNode(toNodeVar: String, iterVar: String, direction: SemanticDirection, fromNodeVar: String, relVar: String): Unit
- def nextRelationship(iterVar: String, direction: SemanticDirection, relVar: String): Unit
- def hasNext(iterVar: String): E
- def nodeGetPropertyById(nodeIdVar: String, propId: Int, propValueVar: String): Unit
- def nodeGetPropertyForVar(nodeIdVar: String, propIdVar: String, propValueVar: String): Unit
- def relationshipGetPropertyById(nodeIdVar: String, propId: Int, propValueVar: String): Unit
- def relationshipGetPropertyForVar(nodeIdVar: String, propIdVar: String, propValueVar: String): Unit
- def lookupPropertyKey(propName: String, propVar: String)
- def indexSeek(iterVar: String, descriptorVar: String, value: E): Unit
- def indexUniqueSeek(name: String, descriptorVar: String, value: E)
- def relType(relIdVar: String, typeVar: String): Unit
- def newIndexDescriptor(descriptorVar: String, labelVar: String, propKeyVar: String): Unit
- def createRelExtractor(extractorName: String): Unit
-
-
- // code structure
- def whileLoop(test: E)(block: MethodStructure[E] => Unit): Unit
- def forEach(varName: String, cypherType: CypherType, iterable: E)(block: MethodStructure[E] => Unit): Unit
- def ifStatement(test: E)(block: MethodStructure[E] => Unit): Unit
- def ternaryOperator(test:E, onSuccess:E, onError: E): E
- def returnSuccessfully(): Unit
-
- // results
- def materializeNode(nodeIdVar: String): E
- def node(nodeIdVar: String): E
- def materializeRelationship(relIdVar: String): E
- def relationship(relIdVar: String): E
- /** Feed single row to the given visitor */
- def visitorAccept(): Unit
- def setInRow(column: String, value: E): Unit
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/LogicalPlanConverter.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/LogicalPlanConverter.scala
deleted file mode 100644
index d2ce9c69784e8..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/LogicalPlanConverter.scala
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir._
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions._
-import org.neo4j.cypher.internal.compiler.v3_0.commands.{ManyQueryExpression, QueryExpression, RangeQueryExpression, SingleQueryExpression}
-import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans
-import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans._
-import org.neo4j.cypher.internal.frontend.v3_0.ast.Expression
-import org.neo4j.cypher.internal.frontend.v3_0.helpers.Eagerly
-import org.neo4j.cypher.internal.frontend.v3_0.{InternalException, ast, symbols}
-
-object LogicalPlanConverter {
-
- def asCodeGenPlan(logicalPlan: LogicalPlan): CodeGenPlan = logicalPlan match {
- case p: SingleRow => singleRowAsCodeGenPlan(p)
- case p: AllNodesScan => allNodesScanAsCodeGenPlan(p)
- case p: NodeByLabelScan => nodeByLabelScanAsCodeGenPlan(p)
- case p: NodeIndexSeek => nodeIndexSeekAsCodeGenPlan(p)
- case p: NodeUniqueIndexSeek => nodeUniqueIndexSeekAsCodeGen(p)
- case p: Expand => expandAsCodeGenPlan(p)
- case p: OptionalExpand => optExpandAsCodeGenPlan(p)
- case p: NodeHashJoin => nodeHashJoinAsCodeGenPlan(p)
- case p: CartesianProduct => cartesianProductAsCodeGenPlan(p)
- case p: Selection => selectionAsCodeGenPlan(p)
- case p: plans.Limit => limitAsCodeGenPlan(p)
- case p: ProduceResult => produceResultsAsCodeGenPlan(p)
- case p: plans.Projection => projectionAsCodeGenPlan(p)
-
- case _ =>
- throw new CantCompileQueryException(s"$logicalPlan is not yet supported")
- }
-
- private def singleRowAsCodeGenPlan(singleRow: SingleRow) = new CodeGenPlan with LeafCodeGenPlan {
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- val (methodHandle, actions) = context.popParent().consume(context, this)
- (methodHandle, Seq(actions))
- }
-
- override val logicalPlan: LogicalPlan = singleRow
- }
-
- private def projectionAsCodeGenPlan(projection: plans.Projection) = new CodeGenPlan {
-
- override val logicalPlan = projection
-
- override def produce(context: CodeGenContext) = {
- context.pushParent(this)
- asCodeGenPlan(projection.lhs.get).produce(context)
- }
-
- override def consume(context: CodeGenContext, child: CodeGenPlan) = {
- val projectionOpName = context.registerOperator(projection)
- val columns = Eagerly.immutableMapValues(projection.expressions,
- (e: ast.Expression) => ExpressionConverter.createProjection(e)(context))
- val vars = columns.map {
- case (name, expr) =>
- val variable = Variable(context.namer.newVarName(), expr.cypherType(context), expr.nullable(context))
- context.addVariable(name, variable)
- variable -> expr
- }
- val (methodHandle, action) = context.popParent().consume(context, this)
- (methodHandle, ir.Projection(projectionOpName, vars, action))
- }
- }
-
- private def produceResultsAsCodeGenPlan(produceResults: ProduceResult) = new CodeGenPlan {
-
- override val logicalPlan = produceResults
-
- override def produce(context: CodeGenContext) = {
- context.pushParent(this)
- asCodeGenPlan(produceResults.lhs.get).produce(context)
- }
-
- override def consume(context: CodeGenContext, child: CodeGenPlan) = {
- val produceResultOpName = context.registerOperator(produceResults)
- val projections = (produceResults.lhs.get match {
- // if lhs is projection than we can simply load things that it projected
- case _: plans.Projection => produceResults.columns.map(c => c -> LoadVariable(context.getVariable(c)))
- // else we have to evaluate all expressions ourselves
- case _ => produceResults.columns.map(c => c -> ExpressionConverter.createExpressionForVariable(c)(context))
- }).toMap
-
- (None, AcceptVisitor(produceResultOpName, projections))
- }
- }
-
- private def allNodesScanAsCodeGenPlan(allNodesScan: AllNodesScan) = new CodeGenPlan with LeafCodeGenPlan {
- override val logicalPlan: LogicalPlan = allNodesScan
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- val variable = Variable(context.namer.newVarName(), symbols.CTNode)
- context.addVariable(allNodesScan.idName.name, variable)
- val (methodHandle, actions) = context.popParent().consume(context, this)
- val opName = context.registerOperator(logicalPlan)
- (methodHandle, Seq(WhileLoop(variable, ScanAllNodes(opName), actions)))
- }
- }
-
- private def nodeByLabelScanAsCodeGenPlan(nodeByLabelScan: NodeByLabelScan) = new CodeGenPlan with LeafCodeGenPlan {
- override val logicalPlan: LogicalPlan = nodeByLabelScan
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- val nodeVar = Variable(context.namer.newVarName(), symbols.CTNode)
- val labelVar = context.namer.newVarName()
- context.addVariable(nodeByLabelScan.idName.name, nodeVar)
- val (methodHandle, actions) = context.popParent().consume(context, this)
- val opName = context.registerOperator(logicalPlan)
- (methodHandle, Seq(WhileLoop(nodeVar, ScanForLabel(opName, nodeByLabelScan.label.name, labelVar), actions)))
- }
- }
-
- private type IndexSeekFun = (String, String, CodeGenExpression, Variable, Instruction) => Instruction
-
- // Used by both nodeIndexSeekAsCodeGenPlan and nodeUniqueIndexSeekAsCodeGenPlan
- private def sharedIndexSeekAsCodeGenPlan(indexSeekFun: IndexSeekFun)(idName: String, valueExpr: QueryExpression[Expression], indexSeek: LogicalPlan) =
- new CodeGenPlan with LeafCodeGenPlan {
- override val logicalPlan: LogicalPlan = indexSeek
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- val nodeVar = Variable(context.namer.newVarName(), symbols.CTNode)
- context.addVariable(idName, nodeVar)
-
- val (methodHandle, actions) = context.popParent().consume(context, this)
- val opName = context.registerOperator(logicalPlan)
- val indexSeekInstruction = valueExpr match {
- //single expression, do a index lookup for that value
- case SingleQueryExpression(e) =>
- val expression = ExpressionConverter.createExpression(e)(context)
- indexSeekFun(opName, context.namer.newVarName(), expression, nodeVar, actions)
- //collection, create set and for each element of the set do an index lookup
- case ManyQueryExpression(e: ast.Collection) =>
- val expression = ToSet(ExpressionConverter.createExpression(e)(context))
- val expressionVar = Variable(context.namer.newVarName(), symbols.CTAny, nullable = false)
-
- ForEachExpression(expressionVar, expression,
- indexSeekFun(opName, context.namer.newVarName(), LoadVariable(expressionVar), nodeVar, actions))
- //Unknown, try to cast to collection and then same as above
- case ManyQueryExpression(e) =>
- val expression = ToSet(CastToCollection(ExpressionConverter.createExpression(e)(context)))
- val expressionVar = Variable(context.namer.newVarName(), symbols.CTAny, nullable = false)
- ForEachExpression(expressionVar, expression,
- indexSeekFun(opName, context.namer.newVarName(), LoadVariable(expressionVar), nodeVar, actions))
-
- case e: RangeQueryExpression[_] =>
- throw new CantCompileQueryException(s"To be done")
-
- case e => throw new InternalException(s"$e is not a valid QueryExpression")
- }
-
- (methodHandle, Seq(indexSeekInstruction))
- }
- }
-
- private def nodeIndexSeekAsCodeGenPlan(indexSeek: NodeIndexSeek) = {
- def indexSeekFun(opName: String, descriptorVar: String, expression: CodeGenExpression,
- nodeVar: Variable, actions: Instruction) =
- WhileLoop(nodeVar, IndexSeek(opName, indexSeek.label.name, indexSeek.propertyKey.name,
- descriptorVar, expression), actions)
-
- sharedIndexSeekAsCodeGenPlan(indexSeekFun)(indexSeek.idName.name, indexSeek.valueExpr, indexSeek)
- }
-
- private def nodeUniqueIndexSeekAsCodeGen(indexSeek: NodeUniqueIndexSeek) = {
- def indexSeekFun(opName: String, descriptorVar: String, expression: CodeGenExpression,
- nodeVar: Variable, actions: Instruction) =
- IndexUniqueSeek(opName, indexSeek.label.name, indexSeek.propertyKey.name,
- descriptorVar, expression, nodeVar, actions)
-
- sharedIndexSeekAsCodeGenPlan(indexSeekFun)(indexSeek.idName.name, indexSeek.valueExpr, indexSeek)
- }
-
- private def nodeHashJoinAsCodeGenPlan(nodeHashJoin: NodeHashJoin) = new CodeGenPlan {
-
- override val logicalPlan: LogicalPlan = nodeHashJoin
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- context.pushParent(this)
- val (Some(symbol), leftInstructions) = asCodeGenPlan(logicalPlan.lhs.get).produce(context)
- val opName = context.registerOperator(logicalPlan)
- val lhsMethod = MethodInvocation(Set(opName), symbol, context.namer.newMethodName(), leftInstructions)
-
- context.pushParent(this)
- val (otherSymbol, rightInstructions) = asCodeGenPlan(logicalPlan.rhs.get).produce(context)
- (otherSymbol, lhsMethod +: rightInstructions)
- }
-
- override def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- if (child.logicalPlan eq logicalPlan.lhs.get) {
- val joinNodes = nodeHashJoin.nodes.map(n => context.getVariable(n.name))
- val probeTableName = context.namer.newVarName()
-
- val lhsSymbols = nodeHashJoin.left.availableSymbols.map(_.name)
- val nodeNames = nodeHashJoin.nodes.map(_.name)
- val notNodeSymbols = lhsSymbols intersect context.variableQueryVariables() diff nodeNames
- val symbols = notNodeSymbols.map(s => s -> context.getVariable(s)).toMap
-
-
- val opName = context.registerOperator(nodeHashJoin)
- val probeTable = BuildProbeTable(opName, probeTableName, joinNodes, symbols)(context)
- val probeTableSymbol = JoinTableMethod(probeTableName, probeTable.tableType)
-
- context.addProbeTable(this, probeTable.joinData)
-
-
- (Some(probeTableSymbol), probeTable)
-
- }
- else if (child.logicalPlan eq logicalPlan.rhs.get) {
-
- val joinNodes = nodeHashJoin.nodes.map(n => context.getVariable(n.name))
- val joinData = context.getProbeTable(this)
- joinData.vars foreach { case (_, symbol) => context.addVariable(symbol.variable, symbol.outgoing) }
-
- val (methodHandle, actions) = context.popParent().consume(context, this)
-
- (methodHandle, GetMatchesFromProbeTable(joinNodes, joinData, actions))
- }
- else {
- throw new InternalException(s"Unexpected consume call by $child")
- }
- }
- }
-
- private def expandAsCodeGenPlan(expand: Expand) = new CodeGenPlan with SingleChildPlan {
-
- override val logicalPlan: LogicalPlan = expand
-
- override def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = expand
- .mode match {
- case ExpandAll => expandAllConsume(context, child)
- case ExpandInto => expandIntoConsume(context, child)
- }
-
- private def expandAllConsume(context: CodeGenContext,
- child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- val relVar = Variable(context.namer.newVarName(), symbols.CTRelationship)
- val toNodeVar = Variable(context.namer.newVarName(), symbols.CTNode)
- context.addVariable(expand.relName.name, relVar)
- context.addVariable(expand.to.name, toNodeVar)
-
- val (methodHandle, action) = context.popParent().consume(context, this)
- val fromNodeVar = context.getVariable(expand.from.name)
- val typeVar2TypeName = expand.types.map(t => context.namer.newVarName() -> t.name).toMap
- val opName = context.registerOperator(expand)
- val expandGenerator = ExpandAllLoopDataGenerator(opName, fromNodeVar, expand.dir, typeVar2TypeName, toNodeVar, relVar)
-
- (methodHandle, WhileLoop(relVar, expandGenerator, action))
- }
-
- private def expandIntoConsume(context: CodeGenContext,
- child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- val relVar = Variable(context.namer.newVarName(), symbols.CTRelationship)
- context.addVariable(expand.relName.name, relVar)
-
- val (methodHandle, action) = context.popParent().consume(context, this)
- val fromNodeVar = context.getVariable(expand.from.name)
- val toNodeVar = context.getVariable(expand.to.name)
- val typeVar2TypeName = expand.types.map(t => context.namer.newVarName() -> t.name).toMap
- val opName = context.registerOperator(expand)
- val expandGenerator = ExpandIntoLoopDataGenerator(opName, fromNodeVar, expand.dir, typeVar2TypeName, toNodeVar, relVar)
-
- (methodHandle, WhileLoop(relVar, expandGenerator, action))
- }
- }
-
- private def optExpandAsCodeGenPlan(optionalExpand: OptionalExpand) = new CodeGenPlan {
-
- override val logicalPlan: LogicalPlan = optionalExpand
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- context.pushParent(this)
- asCodeGenPlan(optionalExpand.lhs.get).produce(context)
- }
-
- override def consume(context: CodeGenContext,
- child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = optionalExpand.mode match {
- case ExpandAll => expandAllConsume(context, child)
- case ExpandInto => expandIntoConsume(context, child)
- }
-
- private def expandAllConsume(context: CodeGenContext,
- child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- //mark relationship and node to visit as nullable
- val relVar = Variable(context.namer.newVarName(), symbols.CTRelationship, nullable = true)
- val toNodeVar = Variable(context.namer.newVarName(), symbols.CTNode, nullable = true)
- context.addVariable(optionalExpand.relName.name, relVar)
- context.addVariable(optionalExpand.to.name, toNodeVar)
-
- val (methodHandle, action) = context.popParent().consume(context, this)
- val fromNodeVar = context.getVariable(optionalExpand.from.name)
- val typeVar2TypeName = optionalExpand.types.map(t => context.namer.newVarName() -> t.name).toMap
- val opName = context.registerOperator(optionalExpand)
-
- //name of flag to check if results were yielded
- val yieldFlag = context.namer.newVarName()
-
- val predicatesAsCodeGenExpressions =
- optionalExpand.
- predicates.
- // We reverse the order of the predicates so the least selective comes first in line
- reverseMap(ExpressionConverter.createPredicate(_)(context))
-
- //wrap inner instructions with predicates -
- // the least selective predicate gets wrapped in an If, which is then wrapped in an If, until we reach the action
- val instructionWithPredicates = predicatesAsCodeGenExpressions.foldLeft[Instruction](
- CheckingInstruction(action, yieldFlag)) {
- case (acc, predicate) => If(predicate, acc)
- }
-
- val expand = ExpandAllLoopDataGenerator(opName, fromNodeVar, optionalExpand.dir, typeVar2TypeName, toNodeVar, relVar)
-
- val loop = WhileLoop(relVar, expand, instructionWithPredicates)
-
- (methodHandle, NullingInstruction(loop, yieldFlag, action, relVar, toNodeVar))
- }
-
- private def expandIntoConsume(context: CodeGenContext,
- child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- //mark relationship to visit as nullable
- val relVar = Variable(context.namer.newVarName(), symbols.CTRelationship, nullable = true)
- context.addVariable(optionalExpand.relName.name, relVar)
-
- val (methodHandle, action) = context.popParent().consume(context, this)
- val fromNodeVar = context.getVariable(optionalExpand.from.name)
- val toNodeVar = context.getVariable(optionalExpand.to.name)
- val typeVar2TypeName = optionalExpand.types.map(t => context.namer.newVarName() -> t.name).toMap
- val opName = context.registerOperator(optionalExpand)
-
- //name of flag to check if results were yielded
- val yieldFlag = context.namer.newVarName()
-
- val predicatesAsCodeGenExpressions =
- optionalExpand.
- predicates.
- // We reverse the order of the predicates so the least selective comes first in line
- reverseMap(ExpressionConverter.createPredicate(_)(context))
-
- //wrap inner instructions with predicates -
- // the least selective predicate gets wrapped in an If, which is then wrapped in an If, until we reach the action
- val instructionWithPredicates = predicatesAsCodeGenExpressions.foldLeft[Instruction](
- CheckingInstruction(action, yieldFlag)) {
- case (acc, predicate) => If(predicate, acc)
- }
-
- val expand = ExpandIntoLoopDataGenerator(opName, fromNodeVar, optionalExpand.dir, typeVar2TypeName, toNodeVar, relVar)
-
- val loop = WhileLoop(relVar, expand, instructionWithPredicates)
-
- (methodHandle, NullingInstruction(loop, yieldFlag, action, relVar))
- }
- }
-
- private def cartesianProductAsCodeGenPlan(cartesianProduct: CartesianProduct) = new CodeGenPlan {
-
- override val logicalPlan: LogicalPlan = cartesianProduct
-
- override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- context.pushParent(this)
- asCodeGenPlan(cartesianProduct.lhs.get).produce(context)
- }
-
- override def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- if (child.logicalPlan eq cartesianProduct.lhs.get) {
- context.pushParent(this)
- val (m, actions) = asCodeGenPlan(cartesianProduct.rhs.get).produce(context)
- (m, actions.headOption.getOrElse(throw new InternalException("Illegal call chain")))
- } else if (child.logicalPlan eq cartesianProduct.rhs.get) {
- val opName = context.registerOperator(cartesianProduct)
- val (m, instruction) = context.popParent().consume(context, this)
- (m, CartesianProductInstruction(opName, instruction))
- }
- else {
- throw new InternalException(s"Unexpected consume call by $child")
- }
- }
- }
-
- private def selectionAsCodeGenPlan(selection: Selection) = new CodeGenPlan with SingleChildPlan {
-
- override val logicalPlan: LogicalPlan = selection
-
- override def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- val opName = context.registerOperator(selection)
- val predicates = selection.predicates.map(
- ExpressionConverter.createPredicate(_)(context)
- )
-
- val (methodHandle, innerBlock) = context.popParent().consume(context, this)
-
- val instruction = predicates.reverse.foldLeft[Instruction](innerBlock) {
- case (acc, predicate) => If(predicate, acc)
- }
-
- (methodHandle, SelectionInstruction(opName, instruction))
- }
- }
-
- private def limitAsCodeGenPlan(limit: plans.Limit) = new CodeGenPlan with SingleChildPlan {
-
- override val logicalPlan: LogicalPlan = limit
-
- override def consume(context: CodeGenContext, child: CodeGenPlan): (Option[JoinTableMethod], Instruction) = {
- val opName = context.registerOperator(limit)
- val count = ExpressionConverter.createExpression(limit.count)(context)
- val counterName = context.namer.newVarName()
-
- val (methodHandle, innerBlock) = context.popParent().consume(context, this)
- val instruction = DecreaseAndReturnWhenZero(opName, counterName, innerBlock, count)
-
- (methodHandle, instruction)
- }
- }
-
- trait SingleChildPlan extends CodeGenPlan {
-
- final override def produce(context: CodeGenContext): (Option[JoinTableMethod], Seq[Instruction]) = {
- context.pushParent(this)
- asCodeGenPlan(logicalPlan.lhs.get).produce(context)
- }
- }
-
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/Namer.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/Namer.scala
deleted file mode 100644
index 4246a2af0bc9f..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/Namer.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import java.util.concurrent.atomic.AtomicInteger
-
-class Namer(classNameCounter: AtomicInteger, varPrefix: String = "v", methodPrefix: String = "m", operationPrefix: String = "OP") {
-
- private var methodNameCounter = 0
- private var varNameCounter = 0
- private var opNameCounter = 0
-
- def newMethodName(): String = {
- methodNameCounter += 1
- s"$methodPrefix$methodNameCounter"
- }
-
- def newVarName(): String = {
- varNameCounter += 1
- s"$varPrefix$varNameCounter"
- }
-
- def newOpName(planName: String): String = {
- opNameCounter += 1
- s"$operationPrefix${opNameCounter}_$planName"
- }
-}
-
-object Namer {
-
- private val classNameCounter = new AtomicInteger()
-
- def apply(): Namer = new Namer(classNameCounter)
-
- def newClassName() = {
- s"GeneratedExecutionPlan${classNameCounter.incrementAndGet()}"
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionEvent.java b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionEvent.java
deleted file mode 100644
index 51430e9c10b4d..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/QueryExecutionEvent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen;
-
-public interface QueryExecutionEvent extends AutoCloseable
-{
- void dbHit();
-
- void row();
-
- @Override
- void close();
-
- QueryExecutionEvent NONE = new QueryExecutionEvent()
- {
- @Override
- public void dbHit()
- {
- }
-
- @Override
- public void row()
- {
- }
-
- @Override
- public void close()
- {
- }
- };
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/AcceptVisitor.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/AcceptVisitor.scala
deleted file mode 100644
index ae771c020b19a..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/AcceptVisitor.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class AcceptVisitor(produceResultOpName: String, columns: Map[String, CodeGenExpression])
- extends Instruction {
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.trace(produceResultOpName) { body =>
- body.incrementRows()
- columns.foreach { case (k, v) =>
- body.setInRow(k, v.generateExpression(body))
- }
- body.visitorAccept()
- }
- }
-
- override protected def operatorId = Set(produceResultOpName)
-
- override protected def children = Seq.empty
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) {
- columns.values.foreach(_.init(generator))
- super.init(generator)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/BuildProbeTable.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/BuildProbeTable.scala
deleted file mode 100644
index 24d4ad82dc301..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/BuildProbeTable.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen._
-
-sealed trait BuildProbeTable extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.allocateProbeTable(name, tableType)
-
- protected val name: String
-
- def joinData: JoinData
- def tableType: JoinTableType
-
- override protected def children = Seq.empty
-}
-
-object BuildProbeTable {
-
- def apply(id: String, name: String, nodes: Set[Variable], valueSymbols: Map[String, Variable])(implicit context: CodeGenContext): BuildProbeTable = {
- if (valueSymbols.isEmpty) BuildCountingProbeTable(id, name, nodes)
- else BuildRecordingProbeTable(id, name, nodes, valueSymbols)
- }
-}
-
-case class BuildRecordingProbeTable(id:String, name: String, nodes: Set[Variable], valueSymbols: Map[String, Variable])
- (implicit context: CodeGenContext)
- extends BuildProbeTable {
-
- override def body[E](generator: MethodStructure[E])(implicit ignored: CodeGenContext): Unit = {
- val value = generator.newTableValue(context.namer.newVarName(), valueStructure)
- fieldToVarName.foreach {
- case (fieldName, localName) => generator.putField(valueStructure, value, localName.incoming.cypherType, fieldName, localName.incoming.name)
- }
- generator.updateProbeTable(valueStructure, name, tableType, nodes.toSeq.map(_.name), value)
- }
-
- override protected def operatorId = Set(id)
-
- private val fieldToVarName = valueSymbols.map {
- case (variable, incoming) => (context.namer.newVarName(), VariableData(variable, incoming, incoming.copy(name = context.namer.newVarName())))
- }
-
- private val varNameToField = fieldToVarName.map {
- case (fieldName, localName) => localName.outgoing.name -> fieldName
- }
-
- private val valueStructure = fieldToVarName.mapValues(_.outgoing.cypherType)
-
- override val tableType = if(nodes.size == 1 ) LongToListTable(valueStructure, varNameToField)
- else LongsToListTable(valueStructure, varNameToField)
-
- val joinData: JoinData = JoinData(fieldToVarName, name, tableType, id)
-}
-
-case class BuildCountingProbeTable(id: String, name: String, nodes: Set[Variable]) extends BuildProbeTable {
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.updateProbeTableCount(name, tableType, nodes.toSeq.map(_.name))
-
- override protected def operatorId = Set(id)
-
- override val tableType = if (nodes.size == 1) LongToCountTable else LongsToCountTable
-
- override def joinData = {
- JoinData(Map.empty, name, tableType, id)
- }
-}
-case class VariableData(variable: String, incoming: Variable, outgoing: Variable)
-case class JoinData(vars: Map[String, VariableData], tableVar: String, tableType: JoinTableType, id: String)
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CartesianProductInstruction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CartesianProductInstruction.scala
deleted file mode 100644
index 7453ebb0b1b7f..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CartesianProductInstruction.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class CartesianProductInstruction(id: String, instruction: Instruction) extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = super.init(generator)
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.trace(id) { body =>
- body.incrementRows()
- instruction.body(body)
- }
-
- override def children = Seq(instruction)
-
- override protected def operatorId = Set(id)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CheckingInstruction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CheckingInstruction.scala
deleted file mode 100644
index e2a8c67cf9037..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CheckingInstruction.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-/**
- * Generates instruction for for updating a provided flag before creating the inner instruction
- */
-case class CheckingInstruction(inner: Instruction, yieldedFlagVar: String)
- extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- inner.init(generator)
- }
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.updateFlag(yieldedFlagVar, newValue = true)
- inner.body(generator)
- }
-
- override def children = Seq(inner)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/DecreaseAndReturnWhenZero.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/DecreaseAndReturnWhenZero.scala
deleted file mode 100644
index bc8c5e946554d..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/DecreaseAndReturnWhenZero.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class DecreaseAndReturnWhenZero(opName: String, variableName: String, action: Instruction, startValue: CodeGenExpression)
- extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = {
- startValue.init(generator)
- val expression = startValue.generateExpression(generator)
- generator.declareCounter(variableName, expression)
- generator.ifStatement(generator.counterEqualsZero(variableName)) { onTrue =>
- onTrue.returnSuccessfully()
- }
- action.init(generator)
- }
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = {
- action.body(generator)
-
- generator.trace(opName) { l1 =>
- l1.incrementRows()
- l1.ifStatement(l1.decreaseCounterAndCheckForZero(variableName)) { l2 =>
- l2.returnSuccessfully()
- }
- }
- }
-
- override protected def children: Seq[Instruction] = Seq(action)
-
- override protected def operatorId = Set(opName)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandAllLoopDataGenerator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandAllLoopDataGenerator.scala
deleted file mode 100644
index fdd69b616f529..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandAllLoopDataGenerator.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.SemanticDirection
-
-case class ExpandAllLoopDataGenerator(opName: String, fromVar: Variable, dir: SemanticDirection,
- types: Map[String, String], toVar: Variable, relVar: Variable)
- extends LoopDataGenerator {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.createRelExtractor(relVar.name)
- types.foreach {
- case (typeVar,relType) => generator.lookupRelationshipTypeId(typeVar, relType)
- }
- }
-
- override def produceIterator[E](iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- if(types.isEmpty)
- generator.nodeGetAllRelationships(iterVar, fromVar.name, dir)
- else
- generator.nodeGetRelationships(iterVar, fromVar.name, dir, types.keys.toSeq)
- generator.incrementDbHits()
- }
-
- override def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])
- (implicit context: CodeGenContext) =
- generator.nextRelationshipAndNode(toVar.name, iterVar, dir, fromVar.name, relVar.name)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandIntoLoopDataGenerator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandIntoLoopDataGenerator.scala
deleted file mode 100644
index 33ffc7d245bf6..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ExpandIntoLoopDataGenerator.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.SemanticDirection
-
-case class ExpandIntoLoopDataGenerator(opName: String, fromVar: Variable, dir: SemanticDirection,
- types: Map[String, String], toVar: Variable, relVar: Variable)
- extends LoopDataGenerator {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.createRelExtractor(relVar.name)
- types.foreach {
- case (typeVar,relType) => generator.lookupRelationshipTypeId(typeVar, relType)
- }
- }
-
- override def produceIterator[E](iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- if(types.isEmpty)
- generator.connectingRelationships(iterVar, fromVar.name, dir, toVar.name)
- else
- generator.connectingRelationships(iterVar, fromVar.name, dir, types.keys.toSeq, toVar.name)
- generator.incrementDbHits()
- }
-
- override def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])
- (implicit context: CodeGenContext) =
- generator.nextRelationship(iterVar, dir, relVar.name)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ForEachExpression.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ForEachExpression.scala
deleted file mode 100644
index deab307e74689..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ForEachExpression.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-
-case class ForEachExpression(varName: Variable, expression: CodeGenExpression, body: Instruction) extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- expression.init(generator)
- body.init(generator)
- }
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
-
- generator.forEach(varName.name, varName.cypherType, expression.generateExpression(generator)) { forBody =>
- body.body(forBody)
- }
-
- override def children = Seq(body)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/GetMatchesFromProbeTable.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/GetMatchesFromProbeTable.scala
deleted file mode 100644
index a30101d6ea8a7..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/GetMatchesFromProbeTable.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-case class GetMatchesFromProbeTable(keys: Set[Variable], code: JoinData, action: Instruction) extends Instruction {
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.trace(code.id) { traced =>
- traced.probe(code.tableVar, code.tableType, keys.toSeq.map(_.name)) { body =>
- body.incrementRows()
- action.body(body)
- }
- }
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- action.init(generator)
-
- override def children = Seq(action)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/If.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/If.scala
deleted file mode 100644
index 3418a5c8f9b6f..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/If.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class If(predicate: CodeGenExpression, block: Instruction) extends Instruction {
- override protected def children: Seq[Instruction] = Seq(block)
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = {
- generator.ifStatement(predicate.generateExpression(generator)) { inner =>
- inner.incrementRows()
- block.body(inner)
- }
- }
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = {
- super.init(generator)
- predicate.init(generator)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexSeek.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexSeek.scala
deleted file mode 100644
index b1583c78c47ff..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexSeek.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-case class IndexSeek(opName: String, labelName: String, propName: String, descriptorVar: String,
- expression: CodeGenExpression) extends LoopDataGenerator {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- expression.init(generator)
- val labelVar = context.namer.newVarName()
- val propKeyVar = context.namer.newVarName()
- generator.lookupLabelId(labelVar, labelName)
- generator.lookupPropertyKey(propName, propKeyVar)
- generator.newIndexDescriptor(descriptorVar, labelVar, propKeyVar)
- }
-
- override def produceIterator[E](iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.indexSeek(iterVar, descriptorVar, expression.generateExpression(generator))
- generator.incrementDbHits()
- }
-
- override def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])
- (implicit context: CodeGenContext) =
- generator.nextNode(nextVar.name, iterVar)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexUniqueSeek.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexUniqueSeek.scala
deleted file mode 100644
index acf4d1c12fd65..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/IndexUniqueSeek.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-
-case class IndexUniqueSeek(opName: String, labelName: String, propName: String, descriptorVar: String,
- expression: CodeGenExpression, node: Variable, inner: Instruction) extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- super.init(generator)
- expression.init(generator)
- val labelVar = context.namer.newVarName()
- val propKeyVar = context.namer.newVarName()
- generator.lookupLabelId(labelVar, labelName)
- generator.lookupPropertyKey(propName, propKeyVar)
- generator.newIndexDescriptor(descriptorVar, labelVar, propKeyVar)
- }
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.trace(opName) { body =>
- body.incrementDbHits()
- body.indexUniqueSeek(node.name, descriptorVar, expression.generateExpression(body))
- body.ifStatement(body.notNull(node.name, node.cypherType)) { ifBody =>
- ifBody.incrementRows()
- inner.body(ifBody)
- }
-
- }
- }
-
- override protected def children: Seq[Instruction] = Seq(inner)
-
- override protected def operatorId: Set[String] = Set(opName)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Instruction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Instruction.scala
deleted file mode 100644
index 063080b9d8f19..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Instruction.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-trait Instruction {
- def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = children.foreach(_.init(generator))
- def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit
-
- protected def children: Seq[Instruction]
-
- private def treeView: Seq[Instruction] = {
- children.foldLeft(Seq(this)) { (acc, child) => acc ++ child.treeView }
- }
-
- // Aggregating methods -- final to prevent overriding
- final def allOperatorIds: Set[String] = treeView.flatMap(_.operatorId).toSet
-
- protected def operatorId: Set[String] = Set.empty
-}
-
-object Instruction {
-
- val empty = new Instruction {
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override protected def children = Seq.empty
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/LoopDataGenerator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/LoopDataGenerator.scala
deleted file mode 100644
index 4c8bf02b29f5b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/LoopDataGenerator.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-// Generates the code that moves data into local variables from the iterator being consumed
-trait LoopDataGenerator {
- def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit
-
- def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext): Unit
-
- def produceIterator[E](iterVarName: String, generator: MethodStructure[E])(implicit context: CodeGenContext): Unit
-
- def opName: String
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/MethodInvocation.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/MethodInvocation.scala
deleted file mode 100644
index d498f3f515022..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/MethodInvocation.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen._
-
-case class MethodInvocation(override val operatorId: Set[String],
- symbol:JoinTableMethod,
- methodName: String,
- statements: Seq[Instruction]) extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.method(symbol.tableType, symbol.name, methodName) { body =>
- statements.foreach(_.init(body))
- statements.foreach(_.body(body))
- }
- }
-
- override def children = statements
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/NullingInstruction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/NullingInstruction.scala
deleted file mode 100644
index 978b9aa2bcd82..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/NullingInstruction.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-
-/**
- * Generates code that runs and afterwards checks if the provided variable has been set,
- * if not it sets all provided variables to null and runs the alternativeAction
- */
-case class NullingInstruction(loop: Instruction, yieldedFlagVar: String, alternativeAction: Instruction,
- nullableVars: Variable*)
- extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- loop.init(generator)
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.declareFlag(yieldedFlagVar, initialValue = false)
- loop.body(generator)
- generator.ifStatement(generator.threeValuedNot(generator.load(yieldedFlagVar))){ ifBody =>
- //mark variables as null
- nullableVars.foreach(v => ifBody.markAsNull(v.name, v.cypherType))
- alternativeAction.body(ifBody)
- }
- }
-
- override def children = Seq(loop)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Projection.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Projection.scala
deleted file mode 100644
index 5667c3cf8c610..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/Projection.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions.CodeGenExpression
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-
-case class Projection(projectionOpName: String, variables: Map[Variable, CodeGenExpression], action: Instruction)
- extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- super.init(generator)
- variables.foreach {
- case (_, expr) => expr.init(generator)
- }
- }
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.trace(projectionOpName) { body =>
- body.incrementRows()
- variables.foreach {
- case (variable, expr) => body.projectVariable(variable.name, expr.generateExpression(body))
- }
- action.body(body)
- }
- }
-
- override protected def operatorId = Set(projectionOpName)
-
- override protected def children = Seq(action)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanAllNodes.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanAllNodes.scala
deleted file mode 100644
index 533483e3c7768..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanAllNodes.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-case class ScanAllNodes(opName: String) extends LoopDataGenerator {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def produceIterator[E](iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.allNodesScan(iterVar)
- generator.incrementDbHits()
- }
-
- override def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])
- (implicit context: CodeGenContext) =
- generator.nextNode(nextVar.name, iterVar)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanForLabel.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanForLabel.scala
deleted file mode 100644
index 32663dd08a01b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/ScanForLabel.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-case class ScanForLabel(opName: String, labelName: String, labelVar: String) extends LoopDataGenerator {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.lookupLabelId(labelVar, labelName)
-
- override def produceIterator[E](iterVar: String, generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- generator.labelScan(iterVar, labelVar)
- generator.incrementDbHits()
- }
-
- override def produceNext[E](nextVar: Variable, iterVar: String, generator: MethodStructure[E])
- (implicit context: CodeGenContext) =
- generator.nextNode(nextVar.name, iterVar)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/SelectionInstruction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/SelectionInstruction.scala
deleted file mode 100644
index f1eccd839b020..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/SelectionInstruction.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class SelectionInstruction(id: String, instruction: Instruction) extends Instruction {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = super.init(generator)
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.trace(id) { body =>
- instruction.body(body)
- }
-
- override def children = Seq(instruction)
-
- override protected def operatorId = Set(id)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/WhileLoop.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/WhileLoop.scala
deleted file mode 100644
index 0670cf731bceb..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/WhileLoop.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-
-case class WhileLoop(variable: Variable, producer: LoopDataGenerator, action: Instruction) extends Instruction {
-
- override def body[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- val iterator = s"${variable.name}Iter"
- generator.trace(producer.opName) { body =>
- producer.produceIterator(iterator, body)
- body.whileLoop(body.hasNext(iterator)) { loopBody =>
- loopBody.incrementDbHits()
- loopBody.incrementRows()
- producer.produceNext(variable, iterator, loopBody)
- action.body(loopBody)
- }
- }
- }
-
- override def operatorId: Set[String] = Set(producer.opName)
-
- override def children = Seq(action)
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit = {
- super.init(generator)
- producer.init(generator)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Addition.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Addition.scala
deleted file mode 100644
index c0518aa06bfaa..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Addition.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class Addition(lhs: CodeGenExpression, rhs: CodeGenExpression) extends CodeGenExpression with BinaryOperator {
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = structure.add
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-
- val validTypes = Seq(CTString, CTFloat, CTInteger, CTList(CTAny))
-
- override def cypherType(implicit context: CodeGenContext) = (lhs.cypherType, rhs.cypherType) match {
- // Strings
- case (CTString, CTString) => CTString
-
- // Collections
- case (ListType(left), ListType(right)) => ListType(left leastUpperBound right)
- case (ListType(innerType), singleElement) => ListType(innerType leastUpperBound singleElement)
- case (singleElement, ListType(innerType)) => ListType(innerType leastUpperBound singleElement)
-
- // Numbers
- case (CTInteger, CTInteger) => CTInteger
- case (Number(_), Number(_)) => CTFloat
-
- // Runtime we'll figure it out
- case _ => CTAny
- }
-
- object Number {
- def unapply(x: CypherType): Option[CypherType] = if (CTNumber.isAssignableFrom(x)) Some(x) else None
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/BinaryOperator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/BinaryOperator.scala
deleted file mode 100644
index 068046d7d9da4..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/BinaryOperator.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-trait BinaryOperator {
- self: CodeGenExpression =>
-
- def lhs: CodeGenExpression
- def rhs: CodeGenExpression
-
- override final def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- lhs.init(generator)
- rhs.init(generator)
- }
-
- override final def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- generator(structure)(context)(lhs.generateExpression(structure), rhs.generateExpression(structure))
-
- protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext): (E, E) => E
-}
-
-// Trait that resolves type based on inputs.
-trait NumericalOpType {
- self : CodeGenExpression =>
-
- def lhs: CodeGenExpression
- def rhs: CodeGenExpression
-
- override def cypherType(implicit context: CodeGenContext) =
- (lhs.cypherType, rhs.cypherType) match {
- case (CTInteger, CTInteger) => CTInteger
- case (_: NumberType, _: NumberType) => CTFloat
- // Runtime we'll figure it out - can't store it in a primitive field unless we are 100% of the type
- case _ => CTAny
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CastToCollection.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CastToCollection.scala
deleted file mode 100644
index b79f620c5a554..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CastToCollection.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class CastToCollection(expression: CodeGenExpression) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = expression.init(generator)
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.castToCollection(expression.generateExpression(structure))
-
- override def nullable(implicit context: CodeGenContext) = expression.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTList(CTAny)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpression.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpression.scala
deleted file mode 100644
index 81f912b275fbf..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpression.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.CypherType
-
-trait CodeGenExpression {
- def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext): Unit
- def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext): E
- def nullable(implicit context: CodeGenContext): Boolean
- def cypherType(implicit context: CodeGenContext): CypherType
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Collection.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Collection.scala
deleted file mode 100644
index 633098fed5f1b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Collection.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class Collection(expressions: Seq[CodeGenExpression]) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- expressions.foreach { instruction =>
- instruction.init(generator)
- }
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.asList(expressions.map(_.generateExpression(structure)))
-
- override def nullable(implicit context: CodeGenContext) = false
-
- override def cypherType(implicit context: CodeGenContext) = {
- val commonType = expressions.map(_.cypherType).reduce[CypherType](_ leastUpperBound _)
-
- CTList(commonType)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Division.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Division.scala
deleted file mode 100644
index 6f0599f8471c2..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Division.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class Division(lhs: CodeGenExpression, rhs: CodeGenExpression)
- extends CodeGenExpression with BinaryOperator with NumericalOpType {
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = structure.div
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Equals.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Equals.scala
deleted file mode 100644
index ea76fead45417..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Equals.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.{IncomparableValuesException, symbols}
-
-case class Equals(lhs: CodeGenExpression, rhs: CodeGenExpression) extends CodeGenExpression {
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-
- override def cypherType(implicit context: CodeGenContext) = symbols.CTBoolean
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- lhs.init(generator)
- rhs.init(generator)
- }
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- if (nullable) structure.threeValuedEquals(lhs.generateExpression(structure), rhs.generateExpression(structure))
- else (lhs, rhs) match {
- case (NodeExpression(v1), NodeExpression(v2)) => structure.eq(structure.load(v1.name), structure.load(v2.name))
- case (RelationshipExpression(v1), RelationshipExpression(v2)) => structure.eq(structure.load(v1.name), structure.load(v2.name))
- case (NodeExpression(_), RelationshipExpression(_)) => throw new
- IncomparableValuesException(symbols.CTNode.toString, symbols.CTRelationship.toString)
- case (RelationshipExpression(_), NodeExpression(_)) => throw new
- IncomparableValuesException(symbols.CTNode.toString, symbols.CTRelationship.toString)
- case _ => structure.threeValuedEquals(lhs.generateExpression(structure), rhs.generateExpression(structure))
- }
- }
-
-
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ExpressionConverter.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ExpressionConverter.scala
deleted file mode 100644
index f37f21c96f099..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ExpressionConverter.scala
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.functions.functionConverter
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.{CTNode, CTRelationship}
-import org.neo4j.cypher.internal.frontend.v3_0.{InternalException, ast, symbols}
-
-object ExpressionConverter {
-
- implicit class ExpressionToPredicate(expression: CodeGenExpression) {
-
- def asPredicate = new CodeGenExpression {
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- if (expression.nullable) structure.coerceToBoolean(expression.generateExpression(structure))
- else expression.generateExpression(structure)
- }
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = expression.init(generator)
-
- override def nullable(implicit context: CodeGenContext) = false
-
- override def cypherType(implicit context: CodeGenContext) = symbols.CTBoolean
- }
- }
-
- def createPredicate(expression: ast.Expression)
- (implicit context: CodeGenContext): CodeGenExpression = expression match {
- case ast.HasLabels(ast.Variable(name), label :: Nil) =>
- val labelIdVariable = context.namer.newVarName()
- val nodeVariable = context.getVariable(name)
- HasLabel(nodeVariable, labelIdVariable, label.name).asPredicate
-
- case exp@ast.Property(node@ast.Variable(name), propKey) if context.semanticTable.isNode(node) =>
- createExpression(exp).asPredicate
-
- case exp@ast.Property(node@ast.Variable(name), propKey) if context.semanticTable.isRelationship(node) =>
- createExpression(exp).asPredicate
-
- case ast.Not(e) => Not(createExpression(e)).asPredicate
-
- case ast.Equals(lhs, rhs) => Equals(createExpression(lhs), createExpression(rhs)).asPredicate
-
- case ast.Or(lhs, rhs) => Or(createExpression(lhs), createExpression(rhs)).asPredicate
-
- case other =>
- throw new CantCompileQueryException(s"Predicate of $other not yet supported")
-
- }
-
- def createExpression(expression: ast.Expression)
- (implicit context: CodeGenContext): CodeGenExpression = expressionConverter(expression, createExpression)
-
- def createProjection(expression: ast.Expression)
- (implicit context: CodeGenContext): CodeGenExpression = {
-
- expression match {
- case node@ast.Variable(name) if context.semanticTable.isNode(node) =>
- NodeProjection(context.getVariable(name))
-
- case rel@ast.Variable(name) if context.semanticTable.isRelationship(rel) =>
- RelationshipProjection(context.getVariable(name))
-
- case e => expressionConverter(e, createProjection)
- }
- }
-
- def createExpressionForVariable(variableQueryVariable: String)
- (implicit context: CodeGenContext): CodeGenExpression = {
-
- val variable = context.getVariable(variableQueryVariable)
-
- variable.cypherType match {
- case CTNode => NodeProjection(variable)
- case CTRelationship => RelationshipProjection(variable)
- case _ => throw new InternalException("The compiled runtime only handles variables pointing to rels and nodes at this time")
- }
- }
-
- private def expressionConverter(expression: ast.Expression, callback: ast.Expression => CodeGenExpression)
- (implicit context: CodeGenContext): CodeGenExpression = {
-
- expression match {
- case node@ast.Variable(name) if context.semanticTable.isNode(node) =>
- NodeExpression(context.getVariable(name))
-
- case rel@ast.Variable(name) if context.semanticTable.isRelationship(rel) =>
- RelationshipExpression(context.getVariable(name))
-
- case ast.Property(node@ast.Variable(name), propKey) if context.semanticTable.isNode(node) =>
- val token = propKey.id(context.semanticTable).map(_.id)
- NodeProperty(token, propKey.name, context.getVariable(name), context.namer.newVarName())
-
- case ast.Property(rel@ast.Variable(name), propKey) if context.semanticTable.isRelationship(rel) =>
- val token = propKey.id(context.semanticTable).map(_.id)
- RelProperty(token, propKey.name, context.getVariable(name), context.namer.newVarName())
-
- case ast.Parameter(name, _) => expressions.Parameter(name, context.namer.newVarName())
-
- case lit: ast.IntegerLiteral => Literal(lit.value)
-
- case lit: ast.DoubleLiteral => Literal(lit.value)
-
- case lit: ast.StringLiteral => Literal(lit.value)
-
- case lit: ast.Literal => Literal(lit.value)
-
- case ast.Collection(exprs) =>
- expressions.Collection(exprs.map(e => callback(e)))
-
- case ast.Add(lhs, rhs) =>
- val leftOp = callback(lhs)
- val rightOp = callback(rhs)
- Addition(leftOp, rightOp)
-
- case ast.Subtract(lhs, rhs) =>
- val leftOp = callback(lhs)
- val rightOp = callback(rhs)
- Subtraction(leftOp, rightOp)
-
- case ast.MapExpression(items) =>
- val map = items.map {
- case (key, expr) => (key.name, callback(expr))
- }.toMap
- MyMap(map)
-
- case ast.HasLabels(ast.Variable(name), label :: Nil) =>
- val labelIdVariable = context.namer.newVarName()
- val nodeVariable = context.getVariable(name)
- HasLabel(nodeVariable, labelIdVariable, label.name)
-
- case ast.Equals(lhs, rhs) => Equals(callback(lhs), callback(rhs))
-
- case ast.Or(lhs, rhs) => Or(callback(lhs), callback(rhs))
-
- case ast.Not(inner) => Not(callback(inner))
-
- case f: ast.FunctionInvocation => functionConverter(f, callback)
-
- case other => throw new CantCompileQueryException(s"Expression of $other not yet supported")
- }
- }
-
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/HasLabel.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/HasLabel.scala
deleted file mode 100644
index aee8394503af6..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/HasLabel.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.{CypherType, _}
-
-case class HasLabel(nodeVariable: Variable, labelVariable: String, labelName: String)
- extends CodeGenExpression {
-
- def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.lookupLabelId(labelVariable, labelName)
-
- def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- val localName = context.namer.newVarName()
- structure.declarePredicate(localName)
-
- structure.incrementDbHits()
- if (nodeVariable.nullable)
- structure.nullable(nodeVariable.name, nodeVariable.cypherType,
- structure.hasLabel(nodeVariable.name, labelVariable, localName))
- else
- structure.hasLabel(nodeVariable.name, labelVariable, localName)
- }
-
- override def nullable(implicit context: CodeGenContext) = nodeVariable.nullable
-
- override def cypherType(implicit context: CodeGenContext): CypherType = CTBoolean
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Literal.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Literal.scala
deleted file mode 100644
index b5f3a5b33e76e..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Literal.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.compiler.v3_0.helpers.LiteralTypeSupport
-
-case class Literal(value: Object) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.constant(value)
-
- override def nullable(implicit context: CodeGenContext) = value == null
-
- override def cypherType(implicit context: CodeGenContext) =
- LiteralTypeSupport.deriveType(value)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/LoadVariable.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/LoadVariable.scala
deleted file mode 100644
index 206c9f9d3d6c6..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/LoadVariable.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.CypherType
-
-case class LoadVariable(variable: Variable) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.load(variable.name)
-
- override def nullable(implicit context: CodeGenContext): Boolean = variable.nullable
- override def cypherType(implicit context: CodeGenContext): CypherType = variable.cypherType
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Modulo.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Modulo.scala
deleted file mode 100644
index 6258ddf6929ef..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Modulo.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class Modulo(lhs: CodeGenExpression, rhs: CodeGenExpression) extends CodeGenExpression with BinaryOperator {
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = structure.mod
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTFloat
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Multiplication.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Multiplication.scala
deleted file mode 100644
index a9daa8d405bb2..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Multiplication.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class Multiplication(lhs: CodeGenExpression, rhs: CodeGenExpression)
- extends CodeGenExpression with BinaryOperator with NumericalOpType {
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = structure.mul
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/MyMap.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/MyMap.scala
deleted file mode 100644
index 86b7e60968a75..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/MyMap.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-//Named MyMap to avoid conflict with collection.Map which makes everything weird
-case class MyMap(instructions: Map[String, CodeGenExpression]) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- instructions.values.foreach { instruction =>
- instruction.init(generator)
- }
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.asMap(instructions.mapValues(_.generateExpression(structure)))
-
- override def nullable(implicit context: CodeGenContext) = false
-
- override def cypherType(implicit context: CodeGenContext) = CTMap
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeExpression.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeExpression.scala
deleted file mode 100644
index 4b1714d6fb8d0..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeExpression.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class NodeExpression(nodeIdVar: Variable) extends CodeGenExpression {
- assert(nodeIdVar.cypherType == symbols.CTNode)
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- if (nodeIdVar.nullable)
- structure.nullable(nodeIdVar.name, nodeIdVar.cypherType, structure.node(nodeIdVar.name))
- else
- structure.node(nodeIdVar.name)
- }
-
- override def nullable(implicit context: CodeGenContext) = nodeIdVar.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTNode
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProjection.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProjection.scala
deleted file mode 100644
index 904e63f00e38e..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProjection.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class NodeProjection(nodeIdVar: Variable) extends CodeGenExpression {
- assert(nodeIdVar.cypherType == symbols.CTNode)
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) ={
- if (nodeIdVar.nullable)
- structure.nullable(nodeIdVar.name, nodeIdVar.cypherType, structure.materializeNode(nodeIdVar.name))
- else
- structure.materializeNode(nodeIdVar.name)
- }
-
- override def nullable(implicit context: CodeGenContext) = nodeIdVar.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTNode
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProperty.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProperty.scala
deleted file mode 100644
index fa554ee0ef74b..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/NodeProperty.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-abstract class ElementProperty(token: Option[Int], propName: String, elementIdVar: String, propKeyVar: String)
- extends CodeGenExpression {
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- if (token.isEmpty) generator.lookupPropertyKey(propName, propKeyVar)
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext): E = {
- val localName = context.namer.newVarName()
- structure.declareProperty(localName)
- if (token.isEmpty)
- propertyByName(structure, localName)
- else
- propertyById(structure, localName)
- structure.incrementDbHits()
- structure.load(localName)
- }
-
- def propertyByName[E](body: MethodStructure[E], localName: String): Unit
-
- def propertyById[E](body: MethodStructure[E], localName: String): Unit
-
- override def nullable(implicit context: CodeGenContext) = true
-}
-
-case class NodeProperty(token: Option[Int], propName: String, nodeIdVar: Variable, propKeyVar: String)
- extends ElementProperty(token, propName, nodeIdVar.name, propKeyVar) {
-
- override def propertyByName[E](body: MethodStructure[E], localName: String) =
- if (nodeIdVar.nullable)
- body.ifStatement(body.notNull(nodeIdVar.name, nodeIdVar.cypherType)) {ifBody =>
- ifBody.nodeGetPropertyForVar(nodeIdVar.name, propKeyVar, localName)
- }
- else
- body.nodeGetPropertyForVar(nodeIdVar.name, propKeyVar, localName)
-
- override def propertyById[E](body: MethodStructure[E], localName: String) =
- if (nodeIdVar.nullable)
- body.ifStatement(body.notNull(nodeIdVar.name, nodeIdVar.cypherType)) {ifBody =>
- ifBody.nodeGetPropertyById(nodeIdVar.name, token.get, localName)
- }
- else
- body.nodeGetPropertyById(nodeIdVar.name, token.get, localName)
-
- override def cypherType(implicit context: CodeGenContext) = CTAny
-}
-
-case class RelProperty(token: Option[Int], propName: String, relIdVar: Variable, propKeyVar: String)
- extends ElementProperty(token, propName, relIdVar.name, propKeyVar) {
-
- override def propertyByName[E](body: MethodStructure[E], localName: String) =
- if (relIdVar.nullable)
- body.ifStatement(body.notNull(relIdVar.name, relIdVar.cypherType)) { ifBody =>
- ifBody.relationshipGetPropertyForVar(relIdVar.name, propKeyVar, localName)
- }
- else
- body.relationshipGetPropertyForVar(relIdVar.name, propKeyVar, localName)
-
- override def propertyById[E](body: MethodStructure[E], localName: String) =
- if (relIdVar.nullable)
- body.ifStatement(body.notNull(relIdVar.name, relIdVar.cypherType)) { ifBody =>
- ifBody.relationshipGetPropertyById(relIdVar.name, token.get, localName)
- }
- else
- body.relationshipGetPropertyById(relIdVar.name, token.get, localName)
-
- override def cypherType(implicit context: CodeGenContext) = CTAny
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Not.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Not.scala
deleted file mode 100644
index b0467e2ca5332..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Not.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-
-case class Not(inner: CodeGenExpression) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {
- inner.init(generator)
- }
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- if (!nullable && inner.cypherType == symbols.CTBoolean) structure.not(inner.generateExpression(structure))
- else structure.threeValuedNot(inner.generateExpression(structure))
-
- override def nullable(implicit context: CodeGenContext) = inner.nullable
-
- override def cypherType(implicit context: CodeGenContext) = symbols.CTBoolean
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Or.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Or.scala
deleted file mode 100644
index f6cf355f44611..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Or.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-
-case class Or(lhs: CodeGenExpression, rhs: CodeGenExpression) extends CodeGenExpression with BinaryOperator {
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-
- override def cypherType(implicit context: CodeGenContext) = symbols.CTBoolean
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- if (!nullable && lhs.cypherType == symbols.CTBoolean && rhs.cypherType == symbols.CTBoolean) structure.or
- else structure.threeValuedOr
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Parameter.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Parameter.scala
deleted file mode 100644
index ee3cbbf4bf6d5..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Parameter.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class Parameter(key: String, variableName: String) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) =
- generator.expectParameter(key, variableName)
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext): E =
- structure.load(variableName)
-
- override def nullable(implicit context: CodeGenContext) = true
-
- override def cypherType(implicit context: CodeGenContext) = CTAny
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipExpression.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipExpression.scala
deleted file mode 100644
index fe6e8ecaa16b4..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipExpression.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class RelationshipExpression(relId: Variable) extends CodeGenExpression {
- assert(relId.cypherType == symbols.CTRelationship)
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- if (relId.nullable)
- structure.nullable(relId.name, relId.cypherType, structure.relationship(relId.name))
- else
- structure.relationship(relId.name)
-
- }
-
- override def nullable(implicit context: CodeGenContext) = relId.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTRelationship
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipProjection.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipProjection.scala
deleted file mode 100644
index 79fc2c7922a38..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/RelationshipProjection.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class RelationshipProjection(relId: Variable) extends CodeGenExpression {
- assert(relId.cypherType == symbols.CTRelationship)
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) ={
- if (relId.nullable)
- structure.nullable(relId.name, relId.cypherType, structure.materializeRelationship(relId.name))
- else
- structure.materializeRelationship(relId.name)
- }
-
- override def nullable(implicit context: CodeGenContext) = relId.nullable
-
- override def cypherType(implicit context: CodeGenContext) = CTRelationship
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Subtraction.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Subtraction.scala
deleted file mode 100644
index 3ddc49e85e60f..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/Subtraction.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-
-case class Subtraction(lhs: CodeGenExpression, rhs: CodeGenExpression)
- extends CodeGenExpression with BinaryOperator with NumericalOpType {
-
- override protected def generator[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = structure.sub
-
- override def nullable(implicit context: CodeGenContext) = lhs.nullable || rhs.nullable
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ToSet.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ToSet.scala
deleted file mode 100644
index 46ecd99b5ba67..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/ToSet.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-
-case class ToSet(expression: CodeGenExpression) extends CodeGenExpression {
-
- override def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = expression.init(generator)
-
- override def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) =
- structure.toSet(expression.generateExpression(structure))
-
- override def nullable(implicit context: CodeGenContext) = false
-
- override def cypherType(implicit context: CodeGenContext) = CTList(CTAny)
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/TypeOf.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/TypeOf.scala
deleted file mode 100644
index 9e1bcbb49230d..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/TypeOf.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{CodeGenContext, MethodStructure, Variable}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols.{CypherType, _}
-
-case class TypeOf(relId: Variable)
- extends CodeGenExpression {
-
- def init[E](generator: MethodStructure[E])(implicit context: CodeGenContext) = {}
-
- def generateExpression[E](structure: MethodStructure[E])(implicit context: CodeGenContext) = {
- val typeName = context.namer.newVarName()
- structure.declare(typeName, CTString)
- if (nullable) {
- structure.ifStatement(structure.notNull(relId.name, relId.cypherType)) { body =>
- body.relType(relId.name, typeName)
- }
- structure.load(typeName)
- }
- else {
- structure.relType(relId.name, typeName)
- structure.load(typeName)
- }
- }
-
- override def nullable(implicit context: CodeGenContext) = relId.nullable
-
- override def cypherType(implicit context: CodeGenContext): CypherType = CTBoolean
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/CodeGenFunction1.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/CodeGenFunction1.scala
deleted file mode 100644
index 5ce4786274185..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/CodeGenFunction1.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.functions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions._
-import org.neo4j.cypher.internal.frontend.v3_0.InternalException
-
-sealed trait CodeGenFunction1 extends ((CodeGenExpression) => CodeGenExpression)
-
-case object IdCodeGenFunction extends CodeGenFunction1 {
-
- override def apply(arg: CodeGenExpression): CodeGenExpression = arg match {
- case n: NodeExpression => LoadVariable(n.nodeIdVar)
- case n: NodeProjection => LoadVariable(n.nodeIdVar)
- case r: RelationshipExpression => LoadVariable(r.relId)
- case r: RelationshipProjection => LoadVariable(r.relId)
- case e => throw new InternalException(s"id function only accepts nodes or relationships not $e")
- }
-}
-
-case object TypeCodeGenFunction extends CodeGenFunction1 {
- override def apply(arg: CodeGenExpression): CodeGenExpression = arg match {
- case r: RelationshipExpression => TypeOf(r.relId)
- case r: RelationshipProjection => TypeOf(r.relId)
- case e => throw new InternalException(s"type function only accepts relationships $e")
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/functionConverter.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/functionConverter.scala
deleted file mode 100644
index 3336de2283818..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/functions/functionConverter.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.functions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.CodeGenContext
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions._
-import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
-import org.neo4j.cypher.internal.frontend.v3_0.ast
-
-object functionConverter {
-
- def apply(fcn: ast.FunctionInvocation, callback: ast.Expression => CodeGenExpression)
- (implicit context: CodeGenContext): CodeGenExpression = fcn.function match {
-
- // id(n)
- case Some(ast.functions.Id) =>
- assert(fcn.args.size == 1)
- IdCodeGenFunction(callback(fcn.args(0)))
-
- // type(r)
- case Some(ast.functions.Type) =>
- assert(fcn.args.size == 1)
- TypeCodeGenFunction(callback(fcn.args(0)))
-
- case other => throw new CantCompileQueryException(s"Function $other not yet supported")
- }
-}
-
-
-
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala
deleted file mode 100644
index 6a404c081181f..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.executionplan
-
-import java.util
-
-import org.neo4j.cypher.internal.compiler.v3_0._
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
-import org.neo4j.cypher.internal.compiler.v3_0.spi.{InternalResultVisitor, QueryContext}
-import org.neo4j.cypher.internal.frontend.v3_0.ProfilerStatisticsNotReadyException
-
-trait SuccessfulCloseable {
- def success(): Unit
- def close(): Unit
-}
-
-/**
- * Main class for compiled execution results, implements everything in InternalExecutionResult
- * except `javaColumns` and `accept` which delegates to the injected compiled code.
- */
-class CompiledExecutionResult(taskCloser: TaskCloser,
- context: QueryContext,
- compiledCode: GeneratedQueryExecution,
- description: Provider[InternalPlanDescription])
- extends StandardInternalExecutionResult(context, Some(taskCloser))
- with StandardInternalExecutionResult.IterateByAccepting {
-
- compiledCode.setSuccessfulCloseable(this)
-
- // *** Delegate to compiled code
- def executionMode: ExecutionMode = compiledCode.executionMode()
-
- override def javaColumns: util.List[String] = compiledCode.javaColumns()
-
- override def accept[EX <: Exception](visitor: InternalResultVisitor[EX]): Unit =
- compiledCode.accept(visitor)
-
- override def executionPlanDescription(): InternalPlanDescription = {
- if (!taskCloser.isClosed) throw new ProfilerStatisticsNotReadyException
-
- compiledCode.executionPlanDescription()
- }
-
- override def queryStatistics() = InternalQueryStatistics()
-
- //TODO delegate to compiled code once writes are being implemented
- override def executionType = READ_ONLY
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala
index 25c746cd7a017..8fca823dd6751 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala
@@ -21,13 +21,8 @@ package org.neo4j.cypher.internal.compiler.v3_0.executionplan
import java.time.Clock
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling.ProfilingTracer
-import org.neo4j.cypher.internal.compiler.v3_0.executionplan.ExecutionPlanBuilder.DescriptionProvider
import org.neo4j.cypher.internal.compiler.v3_0.executionplan.builders._
import org.neo4j.cypher.internal.compiler.v3_0.pipes._
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription.Arguments
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans.LogicalPlan
import org.neo4j.cypher.internal.compiler.v3_0.planner.{CantCompileQueryException, CantHandleQueryException}
import org.neo4j.cypher.internal.compiler.v3_0.profiler.Profiler
@@ -38,23 +33,6 @@ import org.neo4j.cypher.internal.frontend.v3_0.ast.Statement
import org.neo4j.cypher.internal.frontend.v3_0.notification.InternalNotification
import org.neo4j.kernel.GraphDatabaseQueryService
-
-trait RunnablePlan {
- def apply(queryContext: QueryContext,
- execMode: ExecutionMode,
- descriptionProvider: DescriptionProvider,
- params: Map[String, Any],
- closer: TaskCloser): InternalExecutionResult
-}
-
-case class CompiledPlan(updating: Boolean,
- periodicCommit: Option[PeriodicCommitInfo] = None,
- fingerprint: Option[PlanFingerprint] = None,
- plannerUsed: PlannerName,
- planDescription: InternalPlanDescription,
- columns: Seq[String],
- executionResultBuilder: RunnablePlan )
-
case class PipeInfo(pipe: Pipe,
updating: Boolean,
periodicCommit: Option[PeriodicCommitInfo] = None,
@@ -164,27 +142,3 @@ object InterpretedExecutionPlanBuilder {
builder.build(queryId, planType, params, notificationLogger)
}
}
-
-object ExecutionPlanBuilder {
- type DescriptionProvider =
- (InternalPlanDescription => (Provider[InternalPlanDescription], Option[QueryExecutionTracer]))
-
- def tracer( mode: ExecutionMode ) : DescriptionProvider = mode match {
- case ProfileMode =>
- val tracer = new ProfilingTracer()
- (description: InternalPlanDescription) => (new Provider[InternalPlanDescription] {
-
- override def get(): InternalPlanDescription = description.map {
- plan: InternalPlanDescription =>
- val data = tracer.get(plan.id)
- plan.
- addArgument(Arguments.DbHits(data.dbHits())).
- addArgument(Arguments.Rows(data.rows())).
- addArgument(Arguments.Time(data.time()))
- }
- }, Some(tracer))
- case _ => (description: InternalPlanDescription) => (new Provider[InternalPlanDescription] {
- override def get(): InternalPlanDescription = description
- }, None)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/setStaticField.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/SuccessfulCloseable.scala
similarity index 80%
rename from community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/setStaticField.scala
rename to community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/SuccessfulCloseable.scala
index 128d050965588..cf69962c420bb 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/setStaticField.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/SuccessfulCloseable.scala
@@ -17,10 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
+package org.neo4j.cypher.internal.compiler.v3_0.executionplan
-object setStaticField {
- def apply(clazz: Class[_], name: String, value: AnyRef) = {
- clazz.getDeclaredField(name).set(null, value)
- }
+trait SuccessfulCloseable {
+ def success(): Unit
+ def close(): Unit
}
diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/procs/ProcedureExecutionResult.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/procs/ProcedureExecutionResult.scala
index c8a94ed36a2b5..d959994cde142 100644
--- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/procs/ProcedureExecutionResult.scala
+++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/procs/ProcedureExecutionResult.scala
@@ -21,11 +21,10 @@ package org.neo4j.cypher.internal.compiler.v3_0.executionplan.procs
import java.util
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ResultRowImpl
+import org.neo4j.cypher.internal.compiler.v3_0._
import org.neo4j.cypher.internal.compiler.v3_0.executionplan.{InternalQueryType, ProcedureCallMode, StandardInternalExecutionResult}
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
-import org.neo4j.cypher.internal.compiler.v3_0.spi.{QualifiedProcedureName, InternalResultVisitor, QueryContext}
-import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, InternalQueryStatistics, ProfileMode, TaskCloser}
+import org.neo4j.cypher.internal.compiler.v3_0.spi.{InternalResultVisitor, QualifiedProcedureName, QueryContext}
import org.neo4j.cypher.internal.frontend.v3_0.ProfilerStatisticsNotReadyException
/**
diff --git a/community/cypher/cypher-compiler-3.0/src/test/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/SetStaticFieldTest.java b/community/cypher/cypher-compiler-3.0/src/test/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/SetStaticFieldTest.java
deleted file mode 100644
index 59d77b67cfbf0..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/test/java/org/neo4j/cypher/internal/compiler/v3_0/codegen/SetStaticFieldTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class SetStaticFieldTest
-{
- @Test
- public void shouldAssignFields()
- {
- // when
- setStaticField.apply( Apa.class, "X", "HELLO WORLD!" );
-
- // then
- assertEquals( Apa.X, "HELLO WORLD!" );
- }
-
- public static class Apa
- {
- public static String X;
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImplTest.scala b/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImplTest.scala
deleted file mode 100644
index 87a15f2a846ab..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ResultRowImplTest.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen
-
-import org.neo4j.cypher.internal.frontend.v3_0.test_helpers.CypherFunSuite
-
-class ResultRowImplTest extends CypherFunSuite {
- test("int can be handled as a Number") {
- val row = new ResultRowImpl
- row.set("x", 10)
- row.getNumber("x") should equal(10)
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpressionTypesTest.scala b/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpressionTypesTest.scala
deleted file mode 100644
index b580de9d853ae..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/expressions/CodeGenExpressionTypesTest.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir.expressions
-
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Variable, CodeGenContext}
-import org.neo4j.cypher.internal.frontend.v3_0.symbols._
-import org.neo4j.cypher.internal.frontend.v3_0.test_helpers.CypherFunSuite
-
-class CodeGenExpressionTypesTest extends CypherFunSuite {
-
- val int = Literal(1: java.lang.Integer)
- val double = Literal(1.1: java.lang.Double)
- val string = Literal("apa")
- val node = NodeProjection(Variable("a", CTNode))
- val rel = RelationshipProjection(Variable("a", CTRelationship))
- val intCollection = Collection(Seq(int))
- val doubleCollection = Collection(Seq(double))
- val stringCollection = Collection(Seq(string))
- val nodeCollection = Collection(Seq(node))
- val relCollection = Collection(Seq(rel))
-
- test("collection") {
- implicit val context: CodeGenContext = null
-
- Collection(Seq(int)).cypherType should equal(CTList(CTInteger))
- Collection(Seq(double)).cypherType should equal(CTList(CTFloat))
- Collection(Seq(int, double)).cypherType should equal(CTList(CTNumber))
- Collection(Seq(string, int)).cypherType should equal(CTList(CTAny))
- Collection(Seq(node, rel)).cypherType should equal(CTList(CTMap))
- }
-
- test("add") {
- implicit val context: CodeGenContext = null
-
- Addition(int, double).cypherType should equal(CTFloat)
- Addition(string, int).cypherType should equal(CTAny)
- Addition(string, string).cypherType should equal(CTString)
- Addition(intCollection, int).cypherType should equal(CTList(CTInteger))
- Addition(int, intCollection).cypherType should equal(CTList(CTInteger))
- Addition(double, intCollection).cypherType should equal(CTList(CTNumber))
- Addition(doubleCollection, intCollection).cypherType should equal(CTList(CTNumber))
- Addition(stringCollection, string).cypherType should equal(CTList(CTString))
- Addition(string, stringCollection).cypherType should equal(CTList(CTString))
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracerTest.scala b/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracerTest.scala
deleted file mode 100644
index cc3de73c12c13..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/profiling/ProfilingTracerTest.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling
-
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.Id
-import org.neo4j.cypher.internal.frontend.v3_0.test_helpers.CypherFunSuite
-
-class ProfilingTracerTest extends CypherFunSuite {
-
- class Clock extends ProfilingTracer.Clock {
- var nanoTime: Long = 0L
-
- def progress(nanos: Long) {
- assert(nanos > 0, "time must move forwards")
- nanoTime += nanos
- }
- }
-
- test("shouldReportExecutionTimeOfQueryExecution") {
- // given
- val clock = new Clock
- val operatorId = new Id
- val tracer = new ProfilingTracer(clock)
- val event = tracer.executeOperator(operatorId)
-
- // when
- clock.progress(516)
- event.close()
-
- // then
- tracer.timeOf(operatorId) should equal(516)
- }
-
- test("multiple uses of the same Id should aggregate spent time") {
- // given
- val clock = new Clock
- val operatorId = new Id
- val tracer = new ProfilingTracer(clock)
-
- // when
- val event1 = tracer.executeOperator(operatorId)
- clock.progress(12)
- event1.close()
-
- val event2 = tracer.executeOperator(operatorId)
- clock.progress(45)
- event2.close()
-
- // then
- tracer.timeOf(operatorId) should equal(12 + 45)
- }
-
- test("shouldReportDbHitsOfQueryExecution") {
- // given
- val operatorId = new Id
- val tracer = new ProfilingTracer
- val event = tracer.executeOperator(operatorId)
-
- // when
- (0 until 516).foreach { _ =>
- event.dbHit()
- }
-
- event.close()
-
- // then
- tracer.dbHitsOf(operatorId) should equal(516)
- }
-
- test("shouldReportRowsOfQueryExecution") {
- // given
- val operatorId = new Id
- val tracer = new ProfilingTracer
- val event = tracer.executeOperator(operatorId)
-
- // when
- (0 until 516).foreach { _ =>
- event.row()
- }
-
- event.close()
-
- // then
- tracer.rowsOf(operatorId) should equal(516)
-
- }
-}
diff --git a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResultTest.scala b/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResultTest.scala
deleted file mode 100644
index f400da8b4a295..0000000000000
--- a/community/cypher/cypher-compiler-3.0/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResultTest.scala
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.compiler.v3_0.executionplan
-
-import java.util
-
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.neo4j.cypher.internal.compiler.v3_0.codegen.ResultRowImpl
-import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
-import org.neo4j.cypher.internal.compiler.v3_0.spi.{InternalResultRow, InternalResultVisitor, QueryContext}
-import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, NormalMode, TaskCloser}
-import org.neo4j.cypher.internal.frontend.v3_0.test_helpers.CypherFunSuite
-import org.neo4j.helpers.collection.Iterators
-
-import scala.collection.JavaConverters._
-
-class CompiledExecutionResultTest extends CypherFunSuite {
-
- test("should return scala objects") {
- val result = newCompiledExecutionResult(javaMap("foo" -> "", "bar" -> ""))
-
- result.columns should equal(List("foo", "bar"))
- }
-
- test("should return scala objects for string") {
- val result = newCompiledExecutionResult(javaMap("foo" -> "bar"))
-
- result.columnAs[String]("foo").toList should equal(List("bar"))
- }
-
- test("should return scala objects for list") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaList(42)))
-
- result.columnAs[List[Integer]]("foo").toList should equal(List(List(42)))
- }
-
- test("should return scala objects for map") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaMap("key" -> "value")))
-
- result.columnAs[Map[String, Any]]("foo").toList should equal(List(Map("key" -> "value")))
- }
-
- test("should return java objects for string") {
- val result = newCompiledExecutionResult(javaMap("foo" -> "bar"))
-
- Iterators.asList(result.javaColumnAs[String]("foo")) should equal(javaList("bar"))
- }
-
- test("should return java objects for list") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaList(42)))
-
- Iterators.asList(result.javaColumnAs[List[Integer]]("foo")) should equal(javaList(javaList(42)))
- }
-
- test("should return java objects for map") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaMap("key" -> "value")))
-
- Iterators.asList(result.javaColumnAs[Map[String, Any]]("foo")) should equal(javaList(javaMap("key" -> "value")))
- }
-
- test("result should be a scala iterator for string") {
- val result = newCompiledExecutionResult(javaMap("foo" -> "bar"))
-
- result.toList should equal(List(Map("foo" -> "bar")))
- }
-
- test("result should be a scala iterator for list") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaList(42)))
-
- result.toList should equal(List(Map("foo" -> List(42))))
- }
-
- test("result should be a scala iterator for map") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaMap("key" -> "value")))
-
- result.toList should equal(List(Map("foo" -> Map("key" -> "value"))))
- }
-
- test("should return a java iterator for string") {
- val result = newCompiledExecutionResult(javaMap("foo" -> "bar"))
-
- Iterators.asList(result.javaIterator) should equal(javaList(javaMap("foo" -> "bar")))
- }
-
- test("should return a java iterator for list") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaList(42)))
-
- Iterators.asList(result.javaIterator) should equal(javaList(javaMap("foo" -> javaList(42))))
- }
-
- test("should return a java iterator for map") {
- val result = newCompiledExecutionResult(javaMap("foo" -> javaMap("key" -> "value")))
-
- Iterators.asList(result.javaIterator) should equal(javaList(javaMap("foo" -> javaMap("key" -> "value"))))
- }
-
- test("javaIterator hasNext should not call accept if results already consumed") {
- // given
- var timesCalled = 0
- val result = newCompiledExecutionResult(assertion = () => {
- // then
- timesCalled should equal(0)
- timesCalled += 1
- })
-
- // when
- result.accept(new InternalResultVisitor[Exception] {
- override def visit(row: InternalResultRow): Boolean = {
- false
- }
- })
- }
-
- test("close should work after result is consumed") {
- // given
- val result = newCompiledExecutionResult(javaMap("a" -> "1", "b" -> "2"))
-
- // when
- result.accept(new InternalResultVisitor[Exception] {
- override def visit(row: InternalResultRow): Boolean = {
- true
- }
- })
-
- result.close()
-
- // then
- // call of close actually worked
- }
-
- private def newCompiledExecutionResult(row: util.Map[String, Any] = new util.HashMap(),
- taskCloser: TaskCloser = new TaskCloser,
- assertion: () => Unit = () => {}) = {
- val noCompiledCode: GeneratedQueryExecution = new GeneratedQueryExecution {
- override def setSuccessfulCloseable(closeable: SuccessfulCloseable){}
- override def javaColumns(): util.List[String] = new util.ArrayList(row.keySet())
- override def executionMode(): ExecutionMode = NormalMode
- override def accept[E <: Exception](visitor: InternalResultVisitor[E]): Unit = {
- try {
- val rowImpl = new ResultRowImpl()
- row.asScala.foreach { case (k, v) => rowImpl.set(k, v) }
- visitor.visit(rowImpl)
- assertion()
- } finally {
- taskCloser.close(success = true)
- }
- }
- override def executionPlanDescription(): InternalPlanDescription = ???
- }
-
- val context = mock[QueryContext]
- when(context.isGraphKernelResultValue(any())).thenReturn(false)
- new CompiledExecutionResult(taskCloser, context, noCompiledCode, null)
- }
-
- private def javaList[T](elements: T*): util.List[T] = elements.toList.asJava
-
- private def javaMap[K, V](pairs: (K, V)*): util.Map[K, V] = pairs.toMap.asJava
-}
diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledConversionUtils.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledConversionUtils.java
deleted file mode 100644
index 31240becc52fa..0000000000000
--- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledConversionUtils.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.codegen;
-
-import org.neo4j.cypher.internal.frontend.v3_0.CypherTypeException;
-import org.neo4j.cypher.internal.frontend.v3_0.IncomparableValuesException;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Relationship;
-import org.neo4j.helpers.MathUtil;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-// Class with static methods used by compiled execution plans
-public abstract class CompiledConversionUtils
-{
- public static boolean coerceToPredicate( Object value )
- {
- if ( value == null )
- {
- return false;
- }
- if ( value instanceof Boolean )
- {
- return (boolean) value;
- }
- if ( value.getClass().isArray() )
- {
- return Array.getLength( value ) > 0;
- }
- throw new CypherTypeException( "Don't know how to treat that as a predicate: " + value.toString(), null );
- }
-
- public static Collection> toCollection( Object value )
- {
- if ( value == null )
- {
- return Collections.emptyList();
- }
- if ( value instanceof Collection> )
- {
- return ((Collection>) value);
- }
-
- throw new CypherTypeException( "Don't know how to create an iterable out of " + value.getClass().getSimpleName(), null );
- }
-
- public static CompositeKey compositeKey( long... keys )
- {
- return new CompositeKey( keys );
- }
-
- public static class CompositeKey
- {
- private final long[] key;
-
- private CompositeKey( long[] key )
- {
- this.key = key;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- { return true; }
- if ( o == null || getClass() != o.getClass() )
- { return false; }
-
- CompositeKey that = (CompositeKey) o;
-
- return Arrays.equals( key, that.key );
-
- }
-
- @Override
- public int hashCode()
- {
- return Arrays.hashCode( key );
- }
- }
-
- public static Boolean equals( Object lhs, Object rhs )
- {
- if ( lhs == null || rhs == null )
- {
- return null;
- }
-
- if ( (lhs instanceof NodeIdWrapper && !(rhs instanceof NodeIdWrapper)) ||
- (rhs instanceof NodeIdWrapper && !(lhs instanceof NodeIdWrapper)) ||
- (lhs instanceof RelationshipIdWrapper && !(rhs instanceof RelationshipIdWrapper)) ||
- (rhs instanceof RelationshipIdWrapper && !(lhs instanceof RelationshipIdWrapper)) )
- {
-
- throw new IncomparableValuesException( lhs.getClass().getSimpleName(), rhs.getClass().getSimpleName() );
- }
-
- //if floats compare float values if integer types,
- //compare long values
- if ( lhs instanceof Number && rhs instanceof Number )
- {
- if ( (lhs instanceof Double || lhs instanceof Float)
- && (rhs instanceof Double || rhs instanceof Float) )
- {
- double left = ((Number) lhs).doubleValue();
- double right = ((Number) rhs).doubleValue();
- return left == right;
- }
- else if ( (lhs instanceof Double || lhs instanceof Float) )
- {
- double left = ((Number) lhs).doubleValue();
- long right = ((Number) rhs).longValue();
- return MathUtil.numbersEqual( left, right );
- }
- else if ( (rhs instanceof Double || rhs instanceof Float) )
- {
- long left = ((Number) lhs).longValue();
- double right = ((Number) rhs).doubleValue();
- return MathUtil.numbersEqual( right, left );
- }
-
- //evertyhing else is long from cyphers point-of-view
- long left = ((Number) lhs).longValue();
- long right = ((Number) rhs).longValue();
- return left == right;
- }
-
- //for everything else call equals
- return lhs.equals( rhs );
- }
-
- public static Boolean or( Object lhs, Object rhs )
- {
- if ( lhs == null && rhs == null )
- {
- return null;
- }
- else if ( lhs == null && rhs instanceof Boolean )
- {
- return (Boolean) rhs ? true : null;
- }
- else if ( rhs == null && lhs instanceof Boolean )
- {
- return (Boolean) lhs ? true : null;
- }
- else if ( lhs instanceof Boolean && rhs instanceof Boolean )
- {
- return (Boolean) lhs || (Boolean) rhs;
- }
-
- throw new CypherTypeException(
- "Don't know how to do or on: " + (lhs != null ? lhs.toString() : null) + " and " +
- (rhs != null ? rhs.toString() : null), null );
- }
-
- public static Boolean not( Object predicate )
- {
- if ( predicate == null )
- {
- return null;
- }
-
- if ( predicate instanceof Boolean )
- {
- return !(Boolean) predicate;
- }
-
- throw new CypherTypeException( "Don't know how to treat that as a boolean: " + predicate.toString(), null );
- }
-
- public static Object loadParameter( Object value )
- {
- if ( value instanceof Node )
- {
- return new NodeIdWrapper( ((Node) value).getId() );
- }
- else if ( value instanceof Relationship )
- {
- return new RelationshipIdWrapper( ((Relationship) value).getId() );
- }
- else
- {
- return value;
- }
- }
-}
diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledExpandUtils.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledExpandUtils.java
deleted file mode 100644
index b7eb02a65964c..0000000000000
--- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledExpandUtils.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.codegen;
-
-import org.neo4j.graphdb.Direction;
-import org.neo4j.kernel.api.ReadOperations;
-import org.neo4j.kernel.api.exceptions.EntityNotFoundException;
-import org.neo4j.kernel.impl.api.RelationshipDataExtractor;
-import org.neo4j.kernel.impl.api.RelationshipVisitor;
-import org.neo4j.kernel.impl.api.store.RelationshipIterator;
-
-//TODO this must live outside 2.3
-public abstract class CompiledExpandUtils
-{
- public static RelationshipIterator connectingRelationships( ReadOperations readOperations,
- long fromNode, Direction direction, long toNode ) throws EntityNotFoundException
- {
- int fromDegree = readOperations.nodeGetDegree( fromNode, direction );
- if ( fromDegree == 0 )
- {
- return RelationshipIterator.EMPTY;
- }
-
- int toDegree = readOperations.nodeGetDegree( toNode, direction.reverse() );
- if ( toDegree == 0 )
- {
- return RelationshipIterator.EMPTY;
- }
-
- long startNode;
- long endNode;
- Direction relDirection;
- if ( fromDegree < toDegree )
- {
- startNode = fromNode;
- endNode = toNode;
- relDirection = direction;
- }
- else
- {
- startNode = toNode;
- endNode = fromNode;
- relDirection = direction.reverse();
- }
-
- RelationshipIterator allRelationships = readOperations.nodeGetRelationships( startNode, relDirection );
-
- return connectingRelationshipsIterator( allRelationships, startNode, endNode );
- }
-
-
- public static RelationshipIterator connectingRelationships( ReadOperations readOperations,
- long fromNode, Direction direction, long toNode, int... relTypes ) throws EntityNotFoundException
- {
- int fromDegree = calculateTotalDegree( readOperations, fromNode, direction, relTypes);
- if ( fromDegree == 0 )
- {
- return RelationshipIterator.EMPTY;
- }
-
- int toDegree = calculateTotalDegree( readOperations, toNode, direction.reverse(), relTypes );
- if ( toDegree == 0 )
- {
- return RelationshipIterator.EMPTY;
- }
-
- long startNode;
- long endNode;
- Direction relDirection;
- if ( fromDegree < toDegree )
- {
- startNode = fromNode;
- endNode = toNode;
- relDirection = direction;
- }
- else
- {
- startNode = toNode;
- endNode = fromNode;
- relDirection = direction.reverse();
- }
-
- RelationshipIterator allRelationships = readOperations.nodeGetRelationships( startNode, relDirection, relTypes );
-
- return connectingRelationshipsIterator( allRelationships, startNode, endNode );
- }
-
- private static int calculateTotalDegree( ReadOperations readOperations, long fromNode, Direction direction,
- int[] relTypes ) throws EntityNotFoundException
- {
- int degree = 0;
- for ( int relType : relTypes )
- {
- degree += readOperations.nodeGetDegree( fromNode, direction, relType );
- }
-
- return degree;
- }
-
- private static RelationshipIterator connectingRelationshipsIterator( final RelationshipIterator allRelationships,
- final long fromNode, final long toNode )
- {
- return new RelationshipIterator.BaseIterator()
- {
- private final RelationshipDataExtractor extractor = new RelationshipDataExtractor();
-
- @Override
- public boolean relationshipVisit( long relationshipId,
- RelationshipVisitor visitor ) throws EXCEPTION
- {
- visitor.visit( extractor.relationship(), extractor.type(), extractor.startNode(), extractor.endNode() );
- return false;
- }
-
- @Override
- protected boolean fetchNext()
- {
- while ( allRelationships.hasNext() )
- {
- allRelationships.relationshipVisit( allRelationships.next(), extractor );
- if ( extractor.otherNode( fromNode ) == toNode )
- {
- next = extractor.relationship();
- return true;
- }
- }
-
- return false;
- }
- };
- }
-
-}
diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledMathHelper.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledMathHelper.java
deleted file mode 100644
index 91f8abc1359b1..0000000000000
--- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/codegen/CompiledMathHelper.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 2002-2016 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.cypher.internal.codegen;
-
-import org.neo4j.cypher.internal.frontend.v3_0.ArithmeticException;
-import org.neo4j.cypher.internal.frontend.v3_0.CypherTypeException;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is a helper class used by compiled plans for doing basic math operations
- */
-public final class CompiledMathHelper
-{
- private static final double EPSILON = Math.pow( 1, -10 );
-
- /**
- * Do not instantiate this class
- */
- private CompiledMathHelper()
- {
- }
-
- /**
- * Utility function for doing addition
- */
- public static Object add( Object lhs, Object rhs )
- {
- if ( lhs == null || rhs == null )
- {
- return null;
- }
-
- if ( lhs instanceof String || rhs instanceof String )
- {
- return String.valueOf( lhs ) + String.valueOf( rhs );
- }
-
- //List addition
- if ( lhs instanceof List> && rhs instanceof List> )
- {
- List> lhsList = (List>) lhs;
- List> rhsList = (List>) rhs;
- List