From 183ba1701c267ace10a580a8321376602f064bc2 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Mon, 7 Jan 2013 13:00:00 +0100 Subject: [PATCH] Fixes #390 - IN/ANY/NONE/ANY/SINGLE causes RuntimeException for some patterns --- community/cypher/CHANGES.txt | 4 + .../cypher/internal/ExecutionContext.scala | 85 +++++++++++++++++++ .../commands/ComparablePredicate.scala | 5 +- .../internal/commands/InCollection.scala | 2 +- .../internal/commands/PathExpression.scala | 2 +- .../cypher/internal/commands/Predicate.scala | 2 +- .../internal/commands/expressions/Add.scala | 2 +- .../expressions/AggregationExpression.scala | 4 +- .../expressions/CoalesceFunction.scala | 3 +- .../commands/expressions/Collection.scala | 3 +- .../commands/expressions/Expression.scala | 2 +- .../expressions/ExtractFunction.scala | 3 +- .../commands/expressions/FilterFunction.scala | 2 +- .../commands/expressions/HeadFunction.scala | 2 +- .../commands/expressions/IdFunction.scala | 3 +- .../commands/expressions/Identifier.scala | 2 +- .../commands/expressions/LastFunction.scala | 3 +- .../commands/expressions/LengthFunction.scala | 3 +- .../commands/expressions/Literal.scala | 3 +- .../commands/expressions/MathFunction.scala | 3 +- .../commands/expressions/NodesFunction.scala | 3 +- .../internal/commands/expressions/Null.scala | 3 +- .../expressions/NullInNullOutExpression.scala | 2 +- .../commands/expressions/Nullable.scala | 3 +- .../expressions/ParameterExpression.scala | 4 +- .../commands/expressions/Property.scala | 2 +- .../commands/expressions/ReduceFunction.scala | 2 +- .../expressions/RelationshipFunction.scala | 2 +- .../RelationshipTypeFunction.scala | 3 +- .../expressions/ShortestPathExpression.scala | 3 +- .../expressions/StringFunctions.scala | 3 +- .../commands/expressions/TailFunction.scala | 2 +- .../executionplan/ExecutionPlanImpl.scala | 2 +- .../builders/IndexQueryBuilder.scala | 3 +- .../builders/TraversalMatcherBuilder.scala | 3 +- .../cypher/internal/mutation/CreateNode.scala | 3 +- .../mutation/CreateRelationship.scala | 3 +- .../mutation/CreateUniqueAction.scala | 3 +- .../mutation/DeleteEntityAction.scala | 3 +- .../mutation/DeletePropertyAction.scala | 3 +- .../internal/mutation/ForeachAction.scala | 3 +- .../mutation/MapPropertySetAction.scala | 3 +- .../internal/mutation/NamedExpectation.scala | 2 +- .../internal/mutation/PropertySetAction.scala | 3 +- .../cypher/internal/mutation/UniqueLink.scala | 3 +- .../internal/mutation/UpdateAction.scala | 3 +- .../internal/pipes/EagerAggregationPipe.scala | 1 + .../pipes/ExecuteUpdateCommandsPipe.scala | 1 + .../cypher/internal/pipes/ParameterPipe.scala | 1 + .../neo4j/cypher/internal/pipes/Pipe.scala | 67 +-------------- .../cypher/internal/pipes/SlicePipe.scala | 1 + .../cypher/internal/pipes/StartPipe.scala | 1 + .../neo4j/cypher/internal/pipes/TopPipe.scala | 1 + .../aggregation/AggregationFunction.scala | 3 +- .../pipes/aggregation/AvgFunction.scala | 2 +- .../pipes/aggregation/CollectFunction.scala | 3 +- .../pipes/aggregation/CountFunction.scala | 3 +- .../pipes/aggregation/CountStarFunction.scala | 2 +- .../pipes/aggregation/DistinctFunction.scala | 2 +- .../pipes/aggregation/MaxFunction.scala | 4 +- .../aggregation/PercentileFunction.scala | 3 +- .../pipes/aggregation/SumFunction.scala | 2 +- .../BidirectionalTraversalMatcher.scala | 3 +- .../DoubleOptionalPatternMatcher.scala | 2 +- .../pipes/matching/ExpanderStep.scala | 24 ++---- .../pipes/matching/FilteringIterable.scala | 2 +- .../internal/pipes/matching/History.scala | 2 +- .../pipes/matching/MatchingContext.scala | 4 +- .../MonodirectionalTraversalMatcher.scala | 3 +- .../matching/PatterMatchingBuilder.scala | 2 +- .../pipes/matching/PatternMatcher.scala | 2 +- .../SimplePatternMatcherBuilder.scala | 2 +- .../internal/pipes/matching/SingleStep.scala | 4 +- .../pipes/matching/TraversalMatcher.scala | 3 +- .../matching/TraversalPathExpander.scala | 2 +- .../pipes/matching/VarLengthStep.scala | 2 +- .../neo4j/cypher/ExecutionEngineTest.scala | 8 ++ .../scala/org/neo4j/cypher/LazyTest.scala | 2 +- .../scala/org/neo4j/cypher/TypeTest.scala | 2 +- .../cypher/internal/commands/AddTest.scala | 2 +- .../internal/commands/CoalesceTest.scala | 3 +- .../internal/commands/ExtractTest.scala | 2 +- .../commands/HasRelationshipTest.scala | 3 +- .../internal/commands/MathFunctionsTest.scala | 2 +- .../commands/PathExpressionTest.scala | 2 +- .../internal/commands/PropertyValueTest.scala | 2 +- .../cypher/internal/commands/ReduceTest.scala | 2 +- .../internal/commands/SeqPredicateTest.scala | 2 +- .../commands/StringFunctionsTest.scala | 2 +- .../internal/commands/SubtractTest.scala | 2 +- .../commands/expressions/ExpressionTest.scala | 4 +- .../mutation/CreateNodeActionTest.scala | 3 +- .../DoubleCheckCreateUniqueTest.scala | 3 +- .../mutation/MapPropertySetActionTest.scala | 4 +- .../cypher/internal/pipes/FakePipe.scala | 1 + .../cypher/internal/pipes/MutationTest.scala | 2 +- .../pipes/aggregation/AggregateTest.scala | 3 +- .../aggregation/PercentileFunctionsTest.scala | 2 +- .../matching/ExpanderStepReversalTest.scala | 4 +- .../internal/pipes/matching/HistoryTest.scala | 2 +- .../pipes/matching/MatchingContextTest.scala | 3 +- .../pipes/matching/TraversalMatcherTest.scala | 3 +- ...VariableLengthExpanderStepExpandTest.scala | 3 +- .../internal/symbols/SymbolTableTest.scala | 3 +- 104 files changed, 233 insertions(+), 207 deletions(-) create mode 100644 community/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionContext.scala diff --git a/community/cypher/CHANGES.txt b/community/cypher/CHANGES.txt index ba81a6a25ef89..63378f6d29e23 100644 --- a/community/cypher/CHANGES.txt +++ b/community/cypher/CHANGES.txt @@ -1,3 +1,7 @@ +1.9.RC +------- +Fixes #390 - IN/ANY/NONE/ANY/SINGLE causes RuntimeException for some patterns + 1.9.M03 ------- o Fixes #336 - Patterns that re-use a pattern node can produce non-existing matches diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionContext.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionContext.scala new file mode 100644 index 0000000000000..75671ae73b4bb --- /dev/null +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionContext.scala @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2002-2013 "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 + +import mutation.UpdateAction +import pipes.{QueryState, MutableMaps} +import scala.Predef.String +import org.neo4j.cypher.ParameterNotFoundException +import collection.Iterator +import collection.mutable.{Queue, Map => MutableMap} + +object ExecutionContext { + def empty = new ExecutionContext() + + def from(x: (String, Any)*) = new ExecutionContext().newWith(x) +} + +case class ExecutionContext(m: MutableMap[String, Any] = MutableMaps.empty, + mutationCommands: Queue[UpdateAction] = Queue.empty, + state: QueryState = QueryState()) + extends MutableMap[String, Any] { + def get(key: String): Option[Any] = m.get(key) + + def getParam(key: String): Any = + state.params.getOrElse(key, throw new ParameterNotFoundException("Expected a parameter named " + key)) + + def iterator: Iterator[(String, Any)] = m.iterator + + override def size = m.size + + def ++(other: ExecutionContext): ExecutionContext = copy(m = m ++ other.m) + + override def foreach[U](f: ((String, Any)) => U) { + m.foreach(f) + } + + def +=(kv: (String, Any)) = { + m += kv + this + } + + def -=(key: String) = { + m -= key + this + } + + def newWith(newEntries: Seq[(String, Any)]) = + createWithNewMap(MutableMaps.create(this.m) ++= newEntries) + + def newWith(newEntries: scala.collection.Map[String, Any]) = + createWithNewMap(MutableMaps.create(this.m) ++= newEntries) + + def newFrom(newEntries: Seq[(String, Any)]) = + createWithNewMap(MutableMaps.create(newEntries: _*)) + + def newFrom(newEntries: scala.collection.Map[String, Any]) = + createWithNewMap(MutableMaps.create(newEntries)) + + def newWith(newEntry: (String, Any)) = + createWithNewMap(MutableMaps.create(this.m) += newEntry) + + override def clone(): ExecutionContext = newFrom(m) + + protected def createWithNewMap(newMap: MutableMap[String, Any]) = { + copy(m = newMap) + } +} + diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/ComparablePredicate.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/ComparablePredicate.scala index c5dc8eae15e79..989209dba3416 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/ComparablePredicate.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/ComparablePredicate.scala @@ -19,13 +19,10 @@ */ package org.neo4j.cypher.internal.commands -import collection.Seq import expressions.Expression -import org.neo4j.cypher.internal.Comparer -import java.lang.String +import org.neo4j.cypher.internal.{ExecutionContext, Comparer} import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.helpers.IsCollection -import org.neo4j.cypher.internal.pipes.ExecutionContext abstract sealed class ComparablePredicate(left: Expression, right: Expression) extends Predicate with Comparer { def compare(comparisonResult: Int): Boolean diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/InCollection.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/InCollection.scala index d876f6f5957b1..cae991eb49eb8 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/InCollection.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/InCollection.scala @@ -23,7 +23,7 @@ import collection.Seq import expressions.{Closure, Expression} import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class InCollection(collection: Expression, id: String, predicate: Predicate) extends Predicate diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/PathExpression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/PathExpression.scala index cf2aebf19b90e..1763628e8b984 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/PathExpression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/PathExpression.scala @@ -26,7 +26,7 @@ import org.neo4j.cypher.internal.pipes.matching.MatchingContext import org.neo4j.helpers.ThisShouldNotHappenError import org.neo4j.graphdb.Path import org.neo4j.cypher.internal.executionplan.builders.PatternGraphBuilder -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class PathExpression(pathPattern: Seq[Pattern]) extends Expression diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/Predicate.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/Predicate.scala index 889ef50da7128..332c33fc9cda4 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/Predicate.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/Predicate.scala @@ -25,7 +25,7 @@ import org.neo4j.graphdb._ import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.CypherTypeException import org.neo4j.cypher.internal.helpers.{IsCollection, CollectionSupport} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class Predicate extends Expression { def apply(ctx: ExecutionContext) = isMatch(ctx) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Add.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Add.scala index 77b9b24f2207d..e041cb98546b9 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Add.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Add.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.CypherTypeException import org.neo4j.cypher.internal.helpers.{TypeSafeMathSupport, IsCollection} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class Add(a: Expression, b: Expression) extends Expression with TypeSafeMathSupport { def apply(ctx: ExecutionContext) = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/AggregationExpression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/AggregationExpression.scala index 9b0eaad352d83..776aa672311cd 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/AggregationExpression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/AggregationExpression.scala @@ -19,13 +19,11 @@ */ package org.neo4j.cypher.internal.commands.expressions -import collection.Seq import org.neo4j.cypher.internal.pipes.aggregation._ import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.SyntaxException -import collection.Map import org.neo4j.helpers.ThisShouldNotHappenError -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class AggregationExpression extends Expression { def apply(ctx: ExecutionContext) = throw new ThisShouldNotHappenError("Andres", "Aggregations should not be used like this.") diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/CoalesceFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/CoalesceFunction.scala index c95ea4c74cbc2..bddc9b7b6b59c 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/CoalesceFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/CoalesceFunction.scala @@ -20,8 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class CoalesceFunction(children: Expression*) extends Expression { def apply(ctx: ExecutionContext): Any = children.toStream.map(expression => expression(ctx)).find(value => value != null) match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Collection.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Collection.scala index cb14471adf4d5..d36f2d7f5371f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Collection.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Collection.scala @@ -20,8 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class Collection(children: Expression*) extends Expression { def apply(ctx: ExecutionContext): Any = children.map(e => e(ctx)) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Expression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Expression.scala index e5566830bf9f8..408c5f52d7b59 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Expression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Expression.scala @@ -21,8 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher._ import internal.commands.AstNode +import internal.ExecutionContext import internal.helpers.TypeSafeMathSupport -import internal.pipes.ExecutionContext import internal.symbols._ abstract class Expression extends (ExecutionContext => Any) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ExtractFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ExtractFunction.scala index e17e3f4f2ba2a..dd5ed4f9ac979 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ExtractFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ExtractFunction.scala @@ -20,9 +20,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ -import collection.Map import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class ExtractFunction(collection: Expression, id: String, expression: Expression) extends NullInNullOutExpression(collection) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/FilterFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/FilterFunction.scala index d37a648e92834..7bd22bcefdd2b 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/FilterFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/FilterFunction.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.helpers.CollectionSupport import org.neo4j.cypher.internal.commands.Predicate import org.neo4j.cypher.internal.symbols._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class FilterFunction(collection: Expression, id: String, predicate: Predicate) extends NullInNullOutExpression(collection) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/HeadFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/HeadFunction.scala index 366ba7ac3f4a3..88608df6bea8e 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/HeadFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/HeadFunction.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class HeadFunction(collection: Expression) extends NullInNullOutExpression(collection) with CollectionSupport { def compute(value: Any, m: ExecutionContext) = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/IdFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/IdFunction.scala index 45c33fd858b75..2c6394ba11c6b 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/IdFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/IdFunction.scala @@ -21,9 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.graphdb.{Relationship, Node} import org.neo4j.cypher.internal.symbols._ -import collection.Map import org.neo4j.cypher.CypherTypeException -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class IdFunction(inner: Expression) extends NullInNullOutExpression(inner) { def compute(value: Any, m: ExecutionContext) = value match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Identifier.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Identifier.scala index 4f239322d6073..e2cd2a12acc7f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Identifier.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Identifier.scala @@ -23,7 +23,7 @@ import org.neo4j.graphdb.NotFoundException import org.neo4j.cypher.internal.symbols._ import collection.Map import org.neo4j.helpers.ThisShouldNotHappenError -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext object Identifier { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LastFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LastFunction.scala index 9243ced797a84..87ba0e56af36d 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LastFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LastFunction.scala @@ -18,10 +18,9 @@ * along with this program. If not, see . */ package org.neo4j.cypher.internal.commands.expressions -import collection.Map import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class LastFunction(collection: Expression) extends NullInNullOutExpression(collection) with CollectionSupport { def compute(value: Any, m: ExecutionContext) = makeTraversable(value).last diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LengthFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LengthFunction.scala index 28d7c2d3ba064..6b39d11814836 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LengthFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/LengthFunction.scala @@ -21,9 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.graphdb.Path import org.neo4j.cypher.internal.symbols._ -import collection.Map import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class LengthFunction(inner: Expression) extends NullInNullOutExpression(inner) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Literal.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Literal.scala index a24bece6e802e..514bfbba50c3f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Literal.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Literal.scala @@ -20,8 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType} -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class Literal(v: Any) extends Expression { def apply(ctx: ExecutionContext): Any = v diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/MathFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/MathFunction.scala index c76fcb417ad9d..aaae1d2d453a4 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/MathFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/MathFunction.scala @@ -21,9 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import java.lang.Math import org.neo4j.cypher.CypherTypeException -import collection.Map import org.neo4j.cypher.internal.symbols._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class MathFunction(arg: Expression) extends Expression with NumericHelper { def innerExpectedType = NumberType() diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NodesFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NodesFunction.scala index 7f20eca5d27d2..b248fe0ca1c06 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NodesFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NodesFunction.scala @@ -22,9 +22,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.graphdb.Path import org.neo4j.cypher.SyntaxException import org.neo4j.cypher.internal.symbols._ -import collection.Map import collection.JavaConverters._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class NodesFunction(path: Expression) extends NullInNullOutExpression(path) { def compute(value: Any, m: ExecutionContext) = value match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Null.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Null.scala index c6e29d6416d41..e9f8fb38c3c0c 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Null.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Null.scala @@ -20,8 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType, ScalarType} -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class Null() extends Expression { def apply(v1: ExecutionContext) = null diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NullInNullOutExpression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NullInNullOutExpression.scala index 30888d3024096..dfd9c23a968dd 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NullInNullOutExpression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/NullInNullOutExpression.scala @@ -18,7 +18,7 @@ * along with this program. If not, see . */ package org.neo4j.cypher.internal.commands.expressions -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class NullInNullOutExpression(argument: Expression) extends Expression { def compute(value: Any, m: ExecutionContext): Any diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Nullable.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Nullable.scala index 9560262f5477a..56ef17245e80c 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Nullable.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Nullable.scala @@ -21,9 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType} import org.neo4j.cypher.EntityNotFoundException -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.graphdb.NotFoundException +import org.neo4j.cypher.internal.ExecutionContext case class Nullable(expression: Expression) extends Expression { def apply(ctx: ExecutionContext) = try { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ParameterExpression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ParameterExpression.scala index a1568719a8dd3..cc0ece39c1ecd 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ParameterExpression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ParameterExpression.scala @@ -20,9 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols.{SymbolTable, AnyType} -import org.neo4j.cypher.ParameterNotFoundException -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class ParameterExpression(parameterName: String) extends Expression { def apply(ctx: ExecutionContext) = ctx.getParam(parameterName) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Property.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Property.scala index 433e8b0611cac..2292fccafb316 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Property.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/Property.scala @@ -21,8 +21,8 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ import org.neo4j.helpers.ThisShouldNotHappenError -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.cypher.internal.helpers.IsMap +import org.neo4j.cypher.internal.ExecutionContext case class Property(mapExpr: Expression, property: String) extends Expression { def apply(ctx: ExecutionContext): Any = mapExpr(ctx) match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ReduceFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ReduceFunction.scala index afe3fb96e91a6..130aa0c9109b9 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ReduceFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ReduceFunction.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class ReduceFunction(collection: Expression, id: String, expression: Expression, acc:String, init:Expression ) extends NullInNullOutExpression(collection) with CollectionSupport { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipFunction.scala index 926bf4d963da9..3ddecd39a4715 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipFunction.scala @@ -22,7 +22,7 @@ import org.neo4j.graphdb.Path import org.neo4j.cypher.SyntaxException import org.neo4j.cypher.internal.symbols._ import collection.JavaConverters._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class RelationshipFunction(path: Expression) extends NullInNullOutExpression(path) { def compute(value: Any, m: ExecutionContext) = value match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipTypeFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipTypeFunction.scala index fa188fc4704d1..f14091c2736b5 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipTypeFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/RelationshipTypeFunction.scala @@ -21,8 +21,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.graphdb.Relationship import org.neo4j.cypher.internal.symbols._ -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class RelationshipTypeFunction(relationship: Expression) extends NullInNullOutExpression(relationship) { def compute(value: Any, m: ExecutionContext) = value.asInstanceOf[Relationship].getType.name() diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ShortestPathExpression.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ShortestPathExpression.scala index 06e4dd83c69ff..f50dc08d4e6ff 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ShortestPathExpression.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/ShortestPathExpression.scala @@ -27,9 +27,8 @@ import scala.collection.JavaConverters._ import org.neo4j.cypher.SyntaxException import org.neo4j.kernel.Traversal import org.neo4j.graphdb.{Path, DynamicRelationshipType, Node, Expander} -import scala.Some import org.neo4j.cypher.internal.commands.{Pattern, PathExtractor, ShortestPath} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class ShortestPathExpression(ast: ShortestPath) extends Expression with PathExtractor { val pathPattern:Seq[Pattern] = Seq(ast) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/StringFunctions.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/StringFunctions.scala index 3ddee1295525f..291e3aebde3e4 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/StringFunctions.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/StringFunctions.scala @@ -24,8 +24,7 @@ import scala.collection.JavaConverters._ import org.neo4j.cypher.internal.helpers.{IsCollection, CollectionSupport} import org.neo4j.graphdb.{PropertyContainer, Relationship, Node} import org.neo4j.cypher.internal.symbols._ -import org.neo4j.cypher.internal.StringExtras -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.{ExecutionContext, StringExtras} import org.neo4j.cypher.internal.spi.QueryContext abstract class StringFunction(arg: Expression) extends NullInNullOutExpression(arg) with StringHelper with CollectionSupport { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/TailFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/TailFunction.scala index c5ec905028570..b58599f668736 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/TailFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/commands/expressions/TailFunction.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.commands.expressions import org.neo4j.cypher.internal.symbols.{SymbolTable, AnyCollectionType} import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class TailFunction(collection: Expression) extends NullInNullOutExpression(collection) with CollectionSupport { def compute(value: Any, m: ExecutionContext) = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/ExecutionPlanImpl.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/ExecutionPlanImpl.scala index 78c7de59cdcbe..033ff69de5a06 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/ExecutionPlanImpl.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/ExecutionPlanImpl.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.executionplan import builders._ import org.neo4j.cypher.internal.pipes._ import org.neo4j.cypher._ -import internal.ClosingIterator +import internal.{ExecutionContext, ClosingIterator} import internal.commands._ import internal.mutation.{CreateNode, CreateRelationship} import internal.spi.gdsimpl.GDSBackedQueryContext diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/IndexQueryBuilder.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/IndexQueryBuilder.scala index e48a7adc34769..c62f77e792111 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/IndexQueryBuilder.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/IndexQueryBuilder.scala @@ -20,13 +20,14 @@ package org.neo4j.cypher.internal.executionplan.builders import org.neo4j.cypher.internal.commands._ -import org.neo4j.cypher.internal.pipes.{ExecutionContext, RelationshipStartPipe, NodeStartPipe, Pipe} +import org.neo4j.cypher.internal.pipes.{RelationshipStartPipe, NodeStartPipe, Pipe} import org.neo4j.graphdb.{Relationship, Node, GraphDatabaseService} import collection.JavaConverters._ import java.lang.{Iterable => JIterable} import org.neo4j.cypher.MissingIndexException import org.neo4j.cypher.internal.executionplan.{ExecutionPlanInProgress, PlanBuilder} import GetGraphElements.getElements +import org.neo4j.cypher.internal.ExecutionContext class IndexQueryBuilder(graph: GraphDatabaseService) extends PlanBuilder { def apply(plan: ExecutionPlanInProgress) = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/TraversalMatcherBuilder.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/TraversalMatcherBuilder.scala index 34e6deb7279a3..6bcef09007614 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/TraversalMatcherBuilder.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/TraversalMatcherBuilder.scala @@ -24,11 +24,12 @@ import org.neo4j.cypher.internal.commands._ import org.neo4j.helpers.ThisShouldNotHappenError import org.neo4j.graphdb import graphdb.{Node, GraphDatabaseService} -import org.neo4j.cypher.internal.pipes.{ParameterPipe, TraversalMatchPipe, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{ParameterPipe, TraversalMatchPipe} import org.neo4j.cypher.internal.pipes.matching.{MonoDirectionalTraversalMatcher, BidirectionalTraversalMatcher} import org.neo4j.cypher.internal.executionplan.ExecutionPlanInProgress import org.neo4j.cypher.internal.commands.NodeByIndex import org.neo4j.cypher.internal.commands.NodeByIndexQuery +import org.neo4j.cypher.internal.ExecutionContext class TraversalMatcherBuilder(graph: GraphDatabaseService) extends PlanBuilder { def apply(plan: ExecutionPlanInProgress): ExecutionPlanInProgress = extractExpanderStepsFromQuery(plan) match { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateNode.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateNode.scala index dc6fd0d6dd67c..9e4a50c9ab730 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateNode.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateNode.scala @@ -21,9 +21,10 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.commands.expressions.{Literal, Expression} import org.neo4j.cypher.internal.helpers.CollectionSupport -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.cypher.internal.symbols.{SymbolTable, NodeType} import collection.Map +import org.neo4j.cypher.internal.ExecutionContext case class CreateNode(key: String, props: Map[String, Expression]) extends UpdateAction diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateRelationship.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateRelationship.scala index d5ff6f7e70ae1..db7d6fe57d4b1 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateRelationship.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateRelationship.scala @@ -21,9 +21,10 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.commands.expressions.Expression import collection.Map -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.graphdb.Node import org.neo4j.cypher.internal.symbols.{SymbolTable, RelationshipType} +import org.neo4j.cypher.internal.ExecutionContext case class CreateRelationship(key: String, from: (Expression, Map[String, Expression]), diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateUniqueAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateUniqueAction.scala index 3f20afb5fcf67..7135b76264e7f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateUniqueAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/CreateUniqueAction.scala @@ -20,12 +20,13 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.symbols.{CypherType, SymbolTable} -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.helpers.ThisShouldNotHappenError import org.neo4j.cypher.internal.commands.StartItem import org.neo4j.cypher.UniquePathNotUniqueException import org.neo4j.graphdb.{Lock, PropertyContainer} import org.neo4j.cypher.internal.commands.expressions.Expression +import org.neo4j.cypher.internal.ExecutionContext case class CreateUniqueAction(incomingLinks: UniqueLink*) extends UpdateAction { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeleteEntityAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeleteEntityAction.scala index 15cf33929f192..6d8b193a3cae7 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeleteEntityAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeleteEntityAction.scala @@ -20,13 +20,14 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.commands.expressions.Expression -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.cypher.CypherTypeException import org.neo4j.cypher.internal.symbols._ import collection.JavaConverters._ import org.neo4j.kernel.impl.core.NodeManager import org.neo4j.cypher.internal.symbols.AnyType import org.neo4j.graphdb.{PropertyContainer, Path, Relationship, Node} +import org.neo4j.cypher.internal.ExecutionContext case class DeleteEntityAction(elementToDelete: Expression) extends UpdateAction { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeletePropertyAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeletePropertyAction.scala index 588b20d58c7bc..d59e4d8703db1 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeletePropertyAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/DeletePropertyAction.scala @@ -19,11 +19,12 @@ */ package org.neo4j.cypher.internal.mutation -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.graphdb.{Relationship, Node} import org.neo4j.cypher.internal.symbols.{SymbolTable, MapType} import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.helpers.ThisShouldNotHappenError +import org.neo4j.cypher.internal.ExecutionContext case class DeletePropertyAction(element: Expression, property: String) extends UpdateAction { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/ForeachAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/ForeachAction.scala index c206ad5bebfa3..e5109ca5602ba 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/ForeachAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/ForeachAction.scala @@ -22,7 +22,8 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.internal.helpers.CollectionSupport import org.neo4j.cypher.internal.symbols.{AnyCollectionType, SymbolTable} -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} +import org.neo4j.cypher.internal.ExecutionContext case class ForeachAction(collection: Expression, id: String, actions: Seq[UpdateAction]) extends UpdateAction diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/MapPropertySetAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/MapPropertySetAction.scala index d6269b9321845..18d022d3af91b 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/MapPropertySetAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/MapPropertySetAction.scala @@ -20,13 +20,14 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.symbols.{MapType, SymbolTable} -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.graphdb.{Node, Relationship, PropertyContainer} import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.internal.helpers.{MapSupport, IsMap} import org.neo4j.cypher.CypherTypeException import collection.Map import collection.JavaConverters._ +import org.neo4j.cypher.internal.ExecutionContext case class MapPropertySetAction(element: Expression, mapExpression: Expression) extends UpdateAction with GraphElementPropertyFunctions with MapSupport { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/NamedExpectation.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/NamedExpectation.scala index 5458939b38013..1f21629262af4 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/NamedExpectation.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/NamedExpectation.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.commands.expressions.{Literal, Identifier, Expression} import org.neo4j.cypher.internal.symbols.{SymbolTable, TypeSafe} import org.neo4j.graphdb.{Relationship, Node, PropertyContainer} -import org.neo4j.cypher.internal.pipes.ExecutionContext import collection.Map import org.neo4j.cypher.internal.helpers.{IsCollection, IsMap, CollectionSupport} import org.neo4j.cypher.internal.spi.QueryContext +import org.neo4j.cypher.internal.ExecutionContext object NamedExpectation { def apply(name: String): NamedExpectation = NamedExpectation(name, Map.empty) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/PropertySetAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/PropertySetAction.scala index fd1782038d155..9d85551d0f767 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/PropertySetAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/PropertySetAction.scala @@ -20,9 +20,10 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.internal.symbols.SymbolTable -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.graphdb.{Relationship, Node, PropertyContainer} import org.neo4j.cypher.internal.commands.expressions.{Expression, Property} +import org.neo4j.cypher.internal.ExecutionContext case class PropertySetAction(prop: Property, e: Expression) extends UpdateAction with GraphElementPropertyFunctions { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UniqueLink.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UniqueLink.scala index 83857cad8359b..c9ae3ff7f3935 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UniqueLink.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UniqueLink.scala @@ -26,11 +26,12 @@ import expressions.Identifier._ import expressions.Literal import org.neo4j.cypher.internal.symbols.{RelationshipType, NodeType, SymbolTable} import org.neo4j.graphdb.{Node, Direction} -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.cypher.{SyntaxException, CypherTypeException, UniquePathNotUniqueException} import collection.JavaConverters._ import collection.Map import org.neo4j.cypher.internal.helpers.{IsMap, MapSupport} +import org.neo4j.cypher.internal.ExecutionContext object UniqueLink { def apply(start: String, end: String, relName: String, relType: String, dir: Direction): UniqueLink = diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UpdateAction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UpdateAction.scala index d01da90f38f45..6d97a6df848b2 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UpdateAction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/mutation/UpdateAction.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.mutation import org.neo4j.cypher.CypherTypeException import org.neo4j.cypher.internal.symbols._ -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import java.util.{Map => JavaMap} import scala.collection.JavaConverters._ @@ -30,6 +30,7 @@ import org.neo4j.cypher.internal.helpers.CollectionSupport import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.graphdb.{Node, Relationship, PropertyContainer} import org.neo4j.cypher.internal.commands.AstNode +import org.neo4j.cypher.internal.ExecutionContext trait UpdateAction extends TypeSafe with AstNode[UpdateAction] { def exec(context: ExecutionContext, state: QueryState): Traversable[ExecutionContext] diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/EagerAggregationPipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/EagerAggregationPipe.scala index 56a6dad9e9e93..75fceafe5e52f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/EagerAggregationPipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/EagerAggregationPipe.scala @@ -23,6 +23,7 @@ import aggregation.AggregationFunction import org.neo4j.cypher.internal.symbols._ import org.neo4j.cypher.internal.commands.expressions.{Expression, AggregationExpression} import collection.mutable.{Map => MutableMap} +import org.neo4j.cypher.internal.ExecutionContext // Eager aggregation means that this pipe will eagerly load the whole resulting sub graphs before starting // to emit aggregated results. diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ExecuteUpdateCommandsPipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ExecuteUpdateCommandsPipe.scala index 776fd7ce10503..11be34887a8e5 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ExecuteUpdateCommandsPipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ExecuteUpdateCommandsPipe.scala @@ -28,6 +28,7 @@ import org.neo4j.cypher.internal.mutation.CreateNode import collection.Map import org.neo4j.cypher.internal.commands.expressions.{Identifier, Expression} import org.neo4j.cypher.internal.symbols.SymbolTable +import org.neo4j.cypher.internal.ExecutionContext class ExecuteUpdateCommandsPipe(source: Pipe, db: GraphDatabaseService, commands: Seq[UpdateAction]) extends PipeWithSource(source) { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ParameterPipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ParameterPipe.scala index b5d9226107973..3002d926079e1 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ParameterPipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/ParameterPipe.scala @@ -21,6 +21,7 @@ package org.neo4j.cypher.internal.pipes import java.lang.String import org.neo4j.cypher.internal.symbols.SymbolTable +import org.neo4j.cypher.internal.ExecutionContext class ParameterPipe() extends Pipe { def createResults(state: QueryState) = Iterator(ExecutionContext(state = state)) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/Pipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/Pipe.scala index 9f26107ba7434..40bea8401a9fe 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/Pipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/Pipe.scala @@ -19,19 +19,14 @@ */ package org.neo4j.cypher.internal.pipes -import java.lang.String import org.neo4j.cypher.internal.symbols.SymbolTable -import collection.Iterator -import org.neo4j.cypher.internal.mutation.UpdateAction import org.neo4j.graphdb.{GraphDatabaseService, Transaction} -import collection.mutable.{Queue, Map => MutableMap} import scala.collection.JavaConverters._ -import java.util.HashMap import org.neo4j.kernel.GraphDatabaseAPI -import org.neo4j.cypher.ParameterNotFoundException import java.util.concurrent.atomic.AtomicInteger import org.neo4j.cypher.internal.spi.QueryContext import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext /** * Pipe is a central part of Cypher. Most pipes are decorators - they @@ -63,7 +58,7 @@ object MutableMaps { def create(input: scala.collection.Map[String, Any]) = new java.util.HashMap[String, Any](input.asJava).asScala def create(input: (String, Any)*) = { - val m: HashMap[String, Any] = new java.util.HashMap[String, Any]() + val m: java.util.HashMap[String, Any] = new java.util.HashMap[String, Any]() input.foreach { case (k, v) => m.put(k, v) } @@ -100,62 +95,4 @@ class Counter { def increase() { counter.incrementAndGet() } -} - -object ExecutionContext { - def empty = new ExecutionContext() - - def from(x: (String, Any)*) = new ExecutionContext().newWith(x) -} - -case class ExecutionContext(m: MutableMap[String, Any] = MutableMaps.empty, - mutationCommands: Queue[UpdateAction] = Queue.empty, - state:QueryState = QueryState()) - extends MutableMap[String, Any] { - def get(key: String): Option[Any] = m.get(key) - - def getParam(key: String): Any = - state.params.getOrElse(key, throw new ParameterNotFoundException("Expected a parameter named " + key)) - - def iterator: Iterator[(String, Any)] = m.iterator - - override def size = m.size - - def ++(other: ExecutionContext): ExecutionContext = copy(m = m ++ other.m) - - override def foreach[U](f: ((String, Any)) => U) { - m.foreach(f) - } - - def +=(kv: (String, Any)) = { - m += kv - this - } - - def -=(key: String) = { - m -= key - this - } - - def newWith(newEntries: Seq[(String, Any)]) = { - copy(m = (MutableMaps.create(this.m) ++= newEntries)) - } - - def newWith(newEntries: scala.collection.Map[String, Any]) = { - copy(m = (MutableMaps.create(this.m) ++= newEntries)) - } - - def newFrom(newEntries: Seq[(String, Any)]) = { - copy(m = MutableMaps.create(newEntries: _*)) - } - - def newFrom(newEntries: scala.collection.Map[String, Any]) = { - copy(m = MutableMaps.create(newEntries)) - } - - def newWith(newEntry: (String, Any)) = { - copy(m = (MutableMaps.create(this.m) += newEntry)) - } - - override def clone: ExecutionContext = newFrom(m) } \ No newline at end of file diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/SlicePipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/SlicePipe.scala index 1313f2901b61a..1dd88e60a5e11 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/SlicePipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/SlicePipe.scala @@ -21,6 +21,7 @@ package org.neo4j.cypher.internal.pipes import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.helpers.ThisShouldNotHappenError +import org.neo4j.cypher.internal.ExecutionContext class SlicePipe(source:Pipe, skip:Option[Expression], limit:Option[Expression]) extends Pipe { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/StartPipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/StartPipe.scala index 026fb3c7c82d3..b68a18692894d 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/StartPipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/StartPipe.scala @@ -22,6 +22,7 @@ package org.neo4j.cypher.internal.pipes import org.neo4j.graphdb.{Relationship, Node, PropertyContainer} import java.lang.String import org.neo4j.cypher.internal.symbols._ +import org.neo4j.cypher.internal.ExecutionContext abstract class StartPipe[T <: PropertyContainer](inner: Pipe, name: String, createSource: ExecutionContext => Iterable[T]) extends Pipe { def this(inner: Pipe, name: String, sourceIterable: Iterable[T]) = this (inner, name, m => sourceIterable) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/TopPipe.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/TopPipe.scala index c1f0a0a362bab..d07e00ca88ef6 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/TopPipe.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/TopPipe.scala @@ -23,6 +23,7 @@ import org.neo4j.cypher.internal.commands.SortItem import org.neo4j.cypher.internal.symbols.{NumberType, SymbolTable} import collection.mutable.ListBuffer import org.neo4j.cypher.internal.commands.expressions.Expression +import org.neo4j.cypher.internal.ExecutionContext /* * TopPipe is used when a query does a ORDER BY ... LIMIT query. Instead of ordering the whole result set and then diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregationFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregationFunction.scala index e8ced7eb7f520..dac0111da6f4f 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregationFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregationFunction.scala @@ -19,8 +19,7 @@ */ package org.neo4j.cypher.internal.pipes.aggregation -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext /** * Base class for aggregation functions. The function is stateful diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AvgFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AvgFunction.scala index e6659a36bd91d..1c3415adc4951 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AvgFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/AvgFunction.scala @@ -20,8 +20,8 @@ package org.neo4j.cypher.internal.pipes.aggregation import org.neo4j.cypher.internal.commands.expressions.Expression -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.cypher.internal.helpers.TypeSafeMathSupport +import org.neo4j.cypher.internal.ExecutionContext class AvgFunction(val value: Expression) extends AggregationFunction diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CollectFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CollectFunction.scala index 09e7e1af00e91..c6d415ea1ed01 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CollectFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CollectFunction.scala @@ -21,8 +21,7 @@ package org.neo4j.cypher.internal.pipes.aggregation import collection.mutable.ListBuffer import org.neo4j.cypher.internal.commands.expressions.Expression -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class CollectFunction(value:Expression) extends AggregationFunction { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountFunction.scala index d2575b2b53044..cc443bc6c1862 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountFunction.scala @@ -19,9 +19,8 @@ */ package org.neo4j.cypher.internal.pipes.aggregation -import collection.Map import org.neo4j.cypher.internal.commands.expressions.Expression -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class CountFunction(value: Expression) extends AggregationFunction { var count: Long = 0 diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountStarFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountStarFunction.scala index 73e5b942b4ed9..1b32e5d929101 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountStarFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/CountStarFunction.scala @@ -18,7 +18,7 @@ * along with this program. If not, see . */ package org.neo4j.cypher.internal.pipes.aggregation -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class CountStarFunction extends AggregationFunction { var count:Long = 0 diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/DistinctFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/DistinctFunction.scala index b62a190074b84..a742a2cb3e837 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/DistinctFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/DistinctFunction.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.pipes.aggregation import org.neo4j.cypher.internal.commands.expressions.Expression -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class DistinctFunction(value: Expression, inner: AggregationFunction) extends AggregationFunction { val seen = scala.collection.mutable.Set[Any]() diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/MaxFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/MaxFunction.scala index db7a08ec3a045..3dab660fbaea7 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/MaxFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/MaxFunction.scala @@ -19,12 +19,10 @@ */ package org.neo4j.cypher.internal.pipes.aggregation -import org.neo4j.cypher.internal.Comparer +import org.neo4j.cypher.internal.{ExecutionContext, Comparer} import java.lang.Boolean import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.SyntaxException -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext trait MinMax extends AggregationFunction with Comparer { def value: Expression diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunction.scala index 3cd325211021a..22d9b94fb0874 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunction.scala @@ -19,10 +19,9 @@ */ package org.neo4j.cypher.internal.pipes.aggregation -import collection.Map import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.internal.commands.expressions.NumericHelper -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class PercentileContFunction(val value: Expression, val percentile: Expression) extends AggregationFunction diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/SumFunction.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/SumFunction.scala index d23f5f937b569..7aabb41c94f46 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/SumFunction.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/aggregation/SumFunction.scala @@ -20,8 +20,8 @@ package org.neo4j.cypher.internal.pipes.aggregation import org.neo4j.cypher.internal.commands.expressions.Expression -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.cypher.internal.helpers.TypeSafeMathSupport +import org.neo4j.cypher.internal.ExecutionContext class SumFunction(val value: Expression) extends AggregationFunction diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/BidirectionalTraversalMatcher.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/BidirectionalTraversalMatcher.scala index 0a9ce347dd9e4..cc868a64e0161 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/BidirectionalTraversalMatcher.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/BidirectionalTraversalMatcher.scala @@ -20,13 +20,14 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb._ -import org.neo4j.cypher.internal.pipes.{ExecutionContext, QueryState} +import org.neo4j.cypher.internal.pipes.{QueryState} import traversal._ import java.lang.{Iterable => JIterable} import collection.JavaConverters._ import org.neo4j.kernel.{StandardBranchCollisionDetector, Uniqueness, Traversal} import org.neo4j.kernel.impl.traversal.BranchCollisionPolicy import org.neo4j.helpers.ThisShouldNotHappenError +import org.neo4j.cypher.internal.ExecutionContext class BidirectionalTraversalMatcher(steps: ExpanderStep, diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/DoubleOptionalPatternMatcher.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/DoubleOptionalPatternMatcher.scala index e2ce9844f385c..084097d631e15 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/DoubleOptionalPatternMatcher.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/DoubleOptionalPatternMatcher.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.commands.Predicate import collection.immutable.Set import collection.Seq import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext /* Normally, when we encounter an optional relationship, we can try with null and see if that's enough. But for diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStep.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStep.scala index 3d895dd653237..b017219a30a52 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStep.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStep.scala @@ -22,13 +22,14 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb._ import org.neo4j.cypher.internal.commands.Predicate import collection.mutable -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{MutableMaps, QueryState} import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.internal.symbols.SymbolTable import org.neo4j.cypher.internal.commands.True import org.neo4j.cypher.EntityNotFoundException import org.neo4j.helpers.ThisShouldNotHappenError - +import org.neo4j.cypher.internal.ExecutionContext +import collection.mutable.{Map => MutableMap} trait ExpanderStep { def next: Option[ExpanderStep] @@ -147,22 +148,15 @@ case class RelationshipIdentifier() extends MiniMapIdentifier() { protected def extract(m: MiniMap) = m.relationship } -case class MiniMap(var relationship: Relationship, var node: Node, myState:QueryState) - extends ExecutionContext(state = myState) { +case class MiniMap(var relationship: Relationship, + var node: Node, + myState: QueryState, + myMap: MutableMap[String, Any] = MutableMaps.empty) + extends ExecutionContext(state = myState, m = myMap) { override def iterator = throw new RuntimeException override def -(key: String) = throw new RuntimeException - override def +[B1 >: Any](kv: (String, B1)) = throw new RuntimeException - - override def newWith(newEntries: Seq[(String, Any)]) = throw new RuntimeException - - override def newWith(newEntries: scala.collection.Map[String, Any]) = throw new RuntimeException - - override def newFrom(newEntries: Seq[(String, Any)]) = throw new RuntimeException - - override def newFrom(newEntries: scala.collection.Map[String, Any]) = throw new RuntimeException - - override def newWith(newEntry: (String, Any)) = throw new RuntimeException + override protected def createWithNewMap(newMap: mutable.Map[String, Any]) = MiniMap(relationship, node, myState, newMap) } \ No newline at end of file diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/FilteringIterable.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/FilteringIterable.scala index f0c9e0ed63f2f..59c906e69814e 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/FilteringIterable.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/FilteringIterable.scala @@ -20,8 +20,8 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb.{Node, Relationship} -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.cypher.internal.commands.Predicate +import org.neo4j.cypher.internal.ExecutionContext class FilteringIterable(inner: Iterable[Relationship], startNode:Node, predicate: Predicate, ctx:ExecutionContext) diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/History.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/History.scala index e75d4704683a3..7ed8b8af6b4a5 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/History.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/History.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.pipes.matching import collection.Set import collection.mutable.{Map => MutableMap} import org.neo4j.graphdb.Node -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext /** * This class is responsible for keeping track of the already visited parts of the pattern, and the matched diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContext.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContext.scala index c898d7c47e214..9c030ad4f9709 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContext.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContext.scala @@ -21,8 +21,8 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.cypher.internal.commands._ import org.neo4j.cypher.internal.symbols._ -import collection.{immutable, Map} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import collection.immutable +import org.neo4j.cypher.internal.ExecutionContext /** * This class is responsible for deciding how to get the parts of the pattern that are not already bound diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MonodirectionalTraversalMatcher.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MonodirectionalTraversalMatcher.scala index 4aa6d4c655956..fc84b7b334c95 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MonodirectionalTraversalMatcher.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/MonodirectionalTraversalMatcher.scala @@ -20,10 +20,11 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb._ -import org.neo4j.cypher.internal.pipes.{ExecutionContext, QueryState} +import org.neo4j.cypher.internal.pipes.{QueryState} import collection.JavaConverters._ import org.neo4j.kernel.{Uniqueness, Traversal} import traversal._ +import org.neo4j.cypher.internal.ExecutionContext class MonoDirectionalTraversalMatcher(steps: ExpanderStep, start: (ExecutionContext) => Iterable[Node]) extends TraversalMatcher { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatterMatchingBuilder.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatterMatchingBuilder.scala index 1e2c9468ec779..048c670791d94 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatterMatchingBuilder.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatterMatchingBuilder.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb.{Relationship, Node, Direction, PropertyContainer} import org.neo4j.cypher.internal.commands.Predicate import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class PatterMatchingBuilder(patternGraph: PatternGraph, predicates: Seq[Predicate]) extends MatcherBuilder { def getMatches(sourceRow: ExecutionContext): Traversable[ExecutionContext] = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatternMatcher.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatternMatcher.scala index ef16091efd205..141f03f27b848 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatternMatcher.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/PatternMatcher.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb.Node import org.neo4j.cypher.internal.commands.{True, Predicate} import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext import org.neo4j.cypher.EntityNotFoundException +import org.neo4j.cypher.internal.ExecutionContext class PatternMatcher(bindings: Map[String, MatchingPair], predicates: Seq[Predicate], includeOptionals: Boolean, source:ExecutionContext) extends Traversable[ExecutionContext] { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SimplePatternMatcherBuilder.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SimplePatternMatcherBuilder.scala index 18617e72c83f6..5ca5a10dc0875 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SimplePatternMatcherBuilder.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SimplePatternMatcherBuilder.scala @@ -25,7 +25,7 @@ import org.neo4j.graphmatching.{PatternMatcher => SimplePatternMatcher, PatternN import collection.JavaConverters._ import org.neo4j.cypher.internal.commands.{Predicate, True} import org.neo4j.cypher.internal.symbols.SymbolTable -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class SimplePatternMatcherBuilder(pattern: PatternGraph, predicates: Seq[Predicate], symbolTable: SymbolTable) extends MatcherBuilder { def createPatternNodes: immutable.Map[String, SimplePatternNode] = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SingleStep.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SingleStep.scala index d0606d3a62452..a3b07be662b3b 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SingleStep.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/SingleStep.scala @@ -19,10 +19,10 @@ */ package org.neo4j.cypher.internal.pipes.matching -import org.neo4j.graphdb.{Node, Relationship, Direction, RelationshipType} +import org.neo4j.graphdb.{Node, Relationship, Direction} import org.neo4j.cypher.internal.commands.{And, Predicate} import collection.JavaConverters._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext case class SingleStep(id: Int, typ: Seq[String], diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcher.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcher.scala index ceebcd709ddc0..fecafebe114bf 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcher.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcher.scala @@ -19,8 +19,9 @@ */ package org.neo4j.cypher.internal.pipes.matching -import org.neo4j.cypher.internal.pipes.{ExecutionContext, QueryState} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.graphdb.Path +import org.neo4j.cypher.internal.ExecutionContext trait TraversalMatcher { def findMatchingPaths(state: QueryState, context: ExecutionContext): Iterator[Path] diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalPathExpander.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalPathExpander.scala index 90939611074aa..da0884f41d514 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalPathExpander.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/TraversalPathExpander.scala @@ -23,7 +23,7 @@ import org.neo4j.graphdb.{Relationship, Path, PathExpander} import org.neo4j.graphdb.traversal.BranchState import java.lang.{Iterable => JIterable} import collection.JavaConverters._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class TraversalPathExpander(params: ExecutionContext) extends PathExpander[Option[ExpanderStep]] { def expand(path: Path, state: BranchState[Option[ExpanderStep]]): JIterable[Relationship] = { diff --git a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/VarLengthStep.scala b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/VarLengthStep.scala index 166505915c702..53912ac286239 100644 --- a/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/VarLengthStep.scala +++ b/community/cypher/src/main/scala/org/neo4j/cypher/internal/pipes/matching/VarLengthStep.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.pipes.matching import org.neo4j.graphdb.{Node, Relationship, Direction, RelationshipType} import org.neo4j.cypher.internal.commands.Predicate import collection.JavaConverters._ -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext /* Variable length paths are expanded by decreasing min and max, if it's a bounded path. Once diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala index cd8e87b199b7d..7be41ee6c7828 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/ExecutionEngineTest.scala @@ -2325,4 +2325,12 @@ RETURN x0.name? assert(result.toList === List(Map("s" -> "123456789"))) } + + @Test + def filtering_in_match_should_not_fail() { + relate(refNode, createNode("name" -> "Neo")) + val result = parseAndExecute("START n = node(0) MATCH n-->me WHERE me.name IN ['Neo'] RETURN me.name") + + assert(result.toList === List(Map("me.name"->"Neo"))) + } } diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/LazyTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/LazyTest.scala index f27fb0e8b11a0..316caef65bc60 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/LazyTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/LazyTest.scala @@ -74,7 +74,7 @@ class LazyTest extends ExecutionEngineHelper with Assertions { val step = SingleStep(0, Seq(), Direction.OUTGOING, None, True(), True()) val matcher = new MonoDirectionalTraversalMatcher(step, (ctx) => Seq(monitoredNode)) - val ctx = ExecutionContext(state=QueryState(graph)).newWith("a" -> monitoredNode) + val ctx = internal.ExecutionContext(state=QueryState(graph)).newWith("a" -> monitoredNode) //When: val iter = matcher.findMatchingPaths(QueryState(), ctx) diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/TypeTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/TypeTest.scala index c800a6ae3c127..967813c579a3c 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/TypeTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/TypeTest.scala @@ -24,7 +24,7 @@ import internal.commands.expressions.Add import internal.commands.expressions.Literal import internal.commands.expressions.Multiply import internal.commands.expressions.Subtract -import internal.pipes.ExecutionContext +import internal.ExecutionContext import org.junit.Test import org.hamcrest.CoreMatchers._ import org.hamcrest.Matcher diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/AddTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/AddTest.scala index 3105cf3888fd4..dcb86daf798b6 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/AddTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/AddTest.scala @@ -23,7 +23,7 @@ import expressions.{Literal, Add} import org.junit.Test import org.scalatest.Assertions import org.neo4j.cypher.CypherTypeException -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class AddTest extends Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/CoalesceTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/CoalesceTest.scala index edb520690ca1b..56bb5954eca58 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/CoalesceTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/CoalesceTest.scala @@ -21,10 +21,9 @@ package org.neo4j.cypher.internal.commands import expressions.{Expression, Null, Literal, CoalesceFunction} import org.scalatest.Assertions -import collection.Map import org.junit.{Assert, Test} import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType, AnyType} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class CoalesceTest extends Assertions { @Test def givenANonNullValueThenReturnsTheValue() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ExtractTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ExtractTest.scala index d17b6d32c43c1..cd27baadb50cb 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ExtractTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ExtractTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.commands import expressions.{ExtractFunction, Identifier, LengthFunction} import org.scalatest.Assertions import org.junit.Test -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class ExtractTest extends Assertions { @Test def canReturnSomethingFromAnIterable() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/HasRelationshipTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/HasRelationshipTest.scala index 14450f22b3134..f6c91422585a3 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/HasRelationshipTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/HasRelationshipTest.scala @@ -25,8 +25,9 @@ import org.scalatest.Assertions import org.junit.{Before, Test} import org.neo4j.graphdb.{Node, Direction} import org.junit.Assert._ -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext class HasRelationshipTest extends GraphDatabaseTestBase with Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/MathFunctionsTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/MathFunctionsTest.scala index ff69fe81bb8e5..520904c361084 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/MathFunctionsTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/MathFunctionsTest.scala @@ -27,7 +27,7 @@ import expressions.SignFunction import org.junit.Test import org.scalatest.Assertions import org.neo4j.cypher.CypherTypeException -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class MathFunctionsTest extends Assertions { @Test def absTests() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PathExpressionTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PathExpressionTest.scala index 2a8adc8e6ac13..5cb1535b1332a 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PathExpressionTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PathExpressionTest.scala @@ -25,7 +25,7 @@ import org.scalatest.Assertions import org.junit.Test import org.junit.Assert._ import org.neo4j.graphdb.{Path, Direction} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class PathExpressionTest extends GraphDatabaseTestBase with Assertions { @Test def shouldAcceptShortestPathExpressions() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PropertyValueTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PropertyValueTest.scala index 78f9c87aabf08..10e5bd0d05461 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PropertyValueTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/PropertyValueTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.commands import expressions.{Identifier, Property} import org.scalatest.Assertions import org.junit.Test -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class PropertyValueTest extends Assertions { @Test def nullNodeShouldGiveNullProperty() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ReduceTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ReduceTest.scala index c6d04224d34e8..266475cbd2a4d 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ReduceTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/ReduceTest.scala @@ -23,7 +23,7 @@ import expressions.{ReduceFunction, Identifier, LengthFunction, Add, Literal} import org.neo4j.cypher.internal.symbols.{SymbolTable, StringType, NumberType, AnyCollectionType} import org.scalatest.Assertions import org.junit.Test -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class ReduceTest extends Assertions { @Test def canReturnSomethingFromAnIterable() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SeqPredicateTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SeqPredicateTest.scala index 5405036a6f320..1bd53c9811444 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SeqPredicateTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SeqPredicateTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.commands import expressions.{Identifier, Literal} import org.junit.Test import org.scalatest.Assertions -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class SeqPredicateTest extends Assertions { @Test def allStringsBeginWithA() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/StringFunctionsTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/StringFunctionsTest.scala index 6852e66ec67d1..f871e3ee1ba6d 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/StringFunctionsTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/StringFunctionsTest.scala @@ -23,7 +23,7 @@ import expressions._ import org.junit.Test import org.scalatest.Assertions import org.neo4j.cypher.CypherTypeException -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class StringFunctionsTest extends Assertions { @Test def replaceTests() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SubtractTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SubtractTest.scala index 248c0137b5fc2..11c809b56afb5 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SubtractTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/SubtractTest.scala @@ -23,7 +23,7 @@ import expressions.{Literal, Subtract} import org.junit.Test import org.scalatest.Assertions import org.neo4j.cypher.CypherTypeException -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class SubtractTest extends Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/expressions/ExpressionTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/expressions/ExpressionTest.scala index 9209c7e1ce081..66eb2354b8b60 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/expressions/ExpressionTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/commands/expressions/ExpressionTest.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.symbols._ import collection.Map import org.neo4j.cypher.CypherTypeException import org.neo4j.helpers.ThisShouldNotHappenError -import org.neo4j.cypher.internal.pipes.ExecutionContext -import org.neo4j.cypher.internal.commands.{ReturnItem, Return} +import org.neo4j.cypher.internal.commands.ReturnItem +import org.neo4j.cypher.internal.ExecutionContext class ExpressionTest extends Assertions { @Test def replacePropWithCache() { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/CreateNodeActionTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/CreateNodeActionTest.scala index 29e89e214d768..afdd8c0c622a9 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/CreateNodeActionTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/CreateNodeActionTest.scala @@ -22,9 +22,10 @@ package org.neo4j.cypher.internal.mutation import org.scalatest.Assertions import org.neo4j.cypher.ExecutionEngineHelper import org.junit.Test -import org.neo4j.cypher.internal.pipes.{MutableMaps, ExecutionContext, QueryState} +import org.neo4j.cypher.internal.pipes.{MutableMaps, QueryState} import org.neo4j.cypher.internal.commands.expressions.Literal import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext class CreateNodeActionTest extends ExecutionEngineHelper with Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/DoubleCheckCreateUniqueTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/DoubleCheckCreateUniqueTest.scala index 53635e5a53bc1..2213d225bb68f 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/DoubleCheckCreateUniqueTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/DoubleCheckCreateUniqueTest.scala @@ -25,9 +25,10 @@ import org.neo4j.test.ImpermanentGraphDatabase import java.lang.Iterable import org.neo4j.graphdb.Traverser.Order import org.neo4j.graphdb._ -import org.neo4j.cypher.internal.pipes.{ExecutionContext, QueryState} +import org.neo4j.cypher.internal.pipes.{QueryState} import collection.JavaConverters._ import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext /* This test tries to set up a situation where CREATE UNIQUE would fail, unless we guard with locks to prevent creating diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/MapPropertySetActionTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/MapPropertySetActionTest.scala index ad890c42aaf8c..02b7a49fc2ddd 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/MapPropertySetActionTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/mutation/MapPropertySetActionTest.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.mutation import org.junit.{After, Before, Test} import org.neo4j.cypher.GraphDatabaseTestBase import org.neo4j.cypher.internal.commands.expressions.Literal -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.QueryState import org.neo4j.graphdb.{PropertyContainer, Transaction} import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext - +import org.neo4j.cypher.internal.ExecutionContext class MapPropertySetActionTest extends GraphDatabaseTestBase { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/FakePipe.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/FakePipe.scala index f4a79f2f6251e..708cff6cc1257 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/FakePipe.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/FakePipe.scala @@ -21,6 +21,7 @@ package org.neo4j.cypher.internal.pipes import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType} import collection.Map +import org.neo4j.cypher.internal.ExecutionContext class FakePipe(val data: Iterator[Map[String, Any]], identifiers: (String, CypherType)*) extends Pipe { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/MutationTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/MutationTest.scala index bb2140e14858f..4c19bb69d1e23 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/MutationTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/MutationTest.scala @@ -28,7 +28,7 @@ import org.neo4j.graphdb.{Node, NotFoundException} import org.neo4j.cypher.internal.symbols.{SymbolTable, CypherType, NodeType} import org.neo4j.cypher.internal.commands.expressions.{Expression, Literal} import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext - +import org.neo4j.cypher.internal.ExecutionContext class MutationTest extends ExecutionEngineHelper with Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregateTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregateTest.scala index 6d703427a45af..9e12c22d10d72 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregateTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/AggregateTest.scala @@ -20,8 +20,7 @@ package org.neo4j.cypher.internal.pipes.aggregation import org.neo4j.cypher.internal.commands.expressions.{Identifier, Expression} -import org.neo4j.cypher.internal.pipes.ExecutionContext - +import org.neo4j.cypher.internal.ExecutionContext abstract class AggregateTest { def createAggregator(inner: Expression): AggregationFunction diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunctionsTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunctionsTest.scala index 297c29a486809..ac90061017d2b 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunctionsTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/aggregation/PercentileFunctionsTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.pipes.aggregation import org.junit.Test import org.junit.Assert._ import org.neo4j.cypher.internal.commands.expressions.{Expression, Identifier, Literal, NumericHelper} -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext abstract class PercentileTest { def createAggregator(inner: Expression, percentile: Expression): AggregationFunction diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStepReversalTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStepReversalTest.scala index d5163e6c0cad4..ae903e4f9db73 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStepReversalTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/ExpanderStepReversalTest.scala @@ -20,12 +20,12 @@ package org.neo4j.cypher.internal.pipes.matching import org.junit.Test -import org.neo4j.graphdb.{RelationshipType, DynamicRelationshipType, Direction} +import org.neo4j.graphdb.Direction import org.scalatest.Assertions import org.neo4j.cypher.internal.commands.{True, Predicate} import org.neo4j.cypher.internal.commands.expressions.Expression import org.neo4j.cypher.internal.symbols.SymbolTable -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class ExpanderStepReversalTest extends Assertions { val A = "A" diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/HistoryTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/HistoryTest.scala index 22054b7efc912..ee97afa14f4a7 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/HistoryTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/HistoryTest.scala @@ -24,7 +24,7 @@ import org.scalatest.Assertions import org.junit.Test import org.neo4j.graphdb.{DynamicRelationshipType, Direction} import org.neo4j.cypher.internal.commands.True -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class HistoryTest extends GraphDatabaseTestBase with Assertions { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContextTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContextTest.scala index b334bb9fc7b35..6afc8c7e87f1e 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContextTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/MatchingContextTest.scala @@ -35,8 +35,9 @@ import org.neo4j.cypher.internal.executionplan.builders.PatternGraphBuilder import org.neo4j.cypher.internal.commands.True import org.neo4j.cypher.internal.commands.Equals import org.neo4j.cypher.internal.commands.AllInCollection -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext class MatchingContextTest extends GraphDatabaseTestBase with Assertions with PatternGraphBuilder { var a: Node = null diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcherTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcherTest.scala index ac67dd99e8b7e..aa84cc2cdf01e 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcherTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/TraversalMatcherTest.scala @@ -22,11 +22,12 @@ package org.neo4j.cypher.internal.pipes.matching import org.junit.Test import org.neo4j.cypher.GraphDatabaseTestBase import org.neo4j.graphdb.Path -import org.neo4j.cypher.internal.pipes.{ExecutionContext, MutableMaps, QueryState} +import org.neo4j.cypher.internal.pipes.{MutableMaps, QueryState} import org.neo4j.graphdb.DynamicRelationshipType.withName import org.neo4j.graphdb.Direction.OUTGOING import org.neo4j.cypher.internal.commands.True import org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext +import org.neo4j.cypher.internal.ExecutionContext class TraversalMatcherTest extends GraphDatabaseTestBase { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/VariableLengthExpanderStepExpandTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/VariableLengthExpanderStepExpandTest.scala index 9274db29c41e3..24718a573d056 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/VariableLengthExpanderStepExpandTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/pipes/matching/VariableLengthExpanderStepExpandTest.scala @@ -23,7 +23,8 @@ import org.junit.Test import org.neo4j.graphdb.{RelationshipType, DynamicRelationshipType, Direction} import org.neo4j.cypher.internal.commands.True import org.neo4j.cypher.GraphDatabaseTestBase -import org.neo4j.cypher.internal.pipes.{QueryState, ExecutionContext} +import org.neo4j.cypher.internal.pipes.{QueryState} +import org.neo4j.cypher.internal.ExecutionContext class VariableLengthExpanderStepExpandTest extends GraphDatabaseTestBase { diff --git a/community/cypher/src/test/scala/org/neo4j/cypher/internal/symbols/SymbolTableTest.scala b/community/cypher/src/test/scala/org/neo4j/cypher/internal/symbols/SymbolTableTest.scala index c5058eef8816f..8ae3276fc6436 100644 --- a/community/cypher/src/test/scala/org/neo4j/cypher/internal/symbols/SymbolTableTest.scala +++ b/community/cypher/src/test/scala/org/neo4j/cypher/internal/symbols/SymbolTableTest.scala @@ -23,8 +23,7 @@ import org.junit.Test import org.neo4j.cypher.{CypherTypeException, SyntaxException} import org.scalatest.Assertions import org.neo4j.cypher.internal.commands.expressions.{Expression, Add} -import collection.Map -import org.neo4j.cypher.internal.pipes.ExecutionContext +import org.neo4j.cypher.internal.ExecutionContext class SymbolTableTest extends Assertions { @Test def anytype_is_ok() {