diff --git a/community/cypher/cypher-compiler-3.3/src/main/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/rewriter/LogicalPlanRewriter.scala b/community/cypher/cypher-compiler-3.3/src/main/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/rewriter/LogicalPlanRewriter.scala index b0bdd6dce04ec..3fb7e9737e802 100644 --- a/community/cypher/cypher-compiler-3.3/src/main/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/rewriter/LogicalPlanRewriter.scala +++ b/community/cypher/cypher-compiler-3.3/src/main/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/rewriter/LogicalPlanRewriter.scala @@ -57,6 +57,7 @@ trait LogicalPlanRewriter extends Phase[CompilerContext, LogicalPlanState, Logic override def process(from: LogicalPlanState, context: CompilerContext): LogicalPlanState = { val rewritten = from.logicalPlan.endoRewrite(instance(context)) + rewritten.assignIds() // This should be the only place where ids are assigned. from.copy(maybeLogicalPlan = Some(rewritten)) } } diff --git a/community/cypher/cypher-compiler-3.3/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/LogicalPlanAssignedIdTest.scala b/community/cypher/cypher-compiler-3.3/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/LogicalPlanAssignedIdTest.scala index eadacd22911c2..e27e59378af91 100644 --- a/community/cypher/cypher-compiler-3.3/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/LogicalPlanAssignedIdTest.scala +++ b/community/cypher/cypher-compiler-3.3/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/planner/logical/plans/LogicalPlanAssignedIdTest.scala @@ -19,10 +19,12 @@ */ package org.neo4j.cypher.internal.compiler.v3_3.planner.logical.plans +import org.neo4j.cypher.internal.compiler.v3_3.ast.NestedPlanExpression import org.neo4j.cypher.internal.compiler.v3_3.planner.LogicalPlanningTestSupport2 import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{CypherException, Rewriter, topDown} -import org.neo4j.cypher.internal.v3_3.logical.plans.{Apply, Projection, SingleRow} +import org.neo4j.cypher.internal.ir.v3_3.IdName +import org.neo4j.cypher.internal.v3_3.logical.plans._ class LogicalPlanAssignedIdTest extends CypherFunSuite with LogicalPlanningTestSupport2 { test("assignedId survives rewriting") { @@ -63,13 +65,13 @@ class LogicalPlanAssignedIdTest extends CypherFunSuite with LogicalPlanningTestS applyAll.assignIds() - applyAll.assignedId.underlying should equal(6) - applyA.assignedId.underlying should equal(5) - sr1A.assignedId.underlying should equal(4) + applyAll.assignedId.underlying should equal(0) + applyA.assignedId.underlying should equal(1) + sr1A.assignedId.underlying should equal(2) sr2A.assignedId.underlying should equal(3) - applyB.assignedId.underlying should equal(2) - sr1B.assignedId.underlying should equal(1) - sr2B.assignedId.underlying should equal(0) + applyB.assignedId.underlying should equal(4) + sr1B.assignedId.underlying should equal(5) + sr2B.assignedId.underlying should equal(6) } test("cant assign ids twice") { @@ -79,4 +81,14 @@ class LogicalPlanAssignedIdTest extends CypherFunSuite with LogicalPlanningTestS intercept[CypherException](pr.assignIds()) } + test("can assign inside expressions as well") { + val singleRow = SingleRow()(solved) + val inner = AllNodesScan(IdName("x"), Set.empty)(solved) + val filter = Selection(Seq(NestedPlanExpression(inner, literalInt(42))(pos)), singleRow)(solved) + + filter.assignIds() + + val x = inner.assignedId // should not fail + } + } diff --git a/community/cypher/cypher-logical-plans-3.3/src/main/scala/org/neo4j/cypher/internal/v3_3/logical/plans/LogicalPlan.scala b/community/cypher/cypher-logical-plans-3.3/src/main/scala/org/neo4j/cypher/internal/v3_3/logical/plans/LogicalPlan.scala index 60cda2a81c397..9530bc2d0f8bb 100644 --- a/community/cypher/cypher-logical-plans-3.3/src/main/scala/org/neo4j/cypher/internal/v3_3/logical/plans/LogicalPlan.scala +++ b/community/cypher/cypher-logical-plans-3.3/src/main/scala/org/neo4j/cypher/internal/v3_3/logical/plans/LogicalPlan.scala @@ -45,34 +45,29 @@ abstract class LogicalPlan def solved: PlannerQuery with CardinalityEstimation def availableSymbols: Set[IdName] + /* + A id for the logical plan operator, unique inside of the given query tree. These identifiers will be + copied to a rewritten version of the logical plan, as long as there is a one-to-one mapping between + rewritten plans. In other words - once ids have been assigned, plan rewriting should not collapse multiple + operators into one, or split a single one into multiple new ones. + */ def assignedId: LogicalPlanId = _id.getOrElse(throw new InternalException("Plan has not had an id assigned yet")) + def assignIds(): Unit = { - if(_id.nonEmpty) + if (_id.nonEmpty) throw new InternalException("Id has already been assigned") - val builder = new IdAssigner - builder.assignIds() + var count = 0 + val plans = this.findByAllClass[LogicalPlan] + plans.foreach { lp => + lp._id = Some(new LogicalPlanId(count)) + count = count + 1 + } assignedId } private var _id: Option[LogicalPlanId] = None - private class IdAssigner extends TreeBuilder[Int] { - def assignIds() = create(self) - - private var count = 0 - - override protected def build(plan: LogicalPlan) = { - plan._id = Some(new LogicalPlanId(count)) - count = count + 1 - count - } - - override protected def build(plan: LogicalPlan, source: Int) = build(plan) - - override protected def build(plan: LogicalPlan, lhs: Int, rhs: Int) = build(plan) - } - override def rememberMe(old: AnyRef): Unit = _id = old.asInstanceOf[LogicalPlan]._id def leaves: Seq[LogicalPlan] = this.treeFold(Seq.empty[LogicalPlan]) { @@ -207,6 +202,16 @@ final case class SchemaIndexScanUsage(identifier: String, labelId : Int, label: final case class ExplicitNodeIndexUsage(identifier: String, index: String) extends IndexUsage final case class ExplicitRelationshipIndexUsage(identifier: String, index: String) extends IndexUsage +object LogicalPlanId { + // This is probably a safe way of assigning ids, but should only be used in tests + private var counter = 0 + def DEFAULT: LogicalPlanId = { + val id = new LogicalPlanId(counter) + counter += 1 + id + } +} + class LogicalPlanId(val underlying: Int) extends AnyVal { def ++ : LogicalPlanId = new LogicalPlanId(underlying + 1) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/BuildInterpretedExecutionPlan.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/BuildInterpretedExecutionPlan.scala index 4d9eb222d1504..c0bc26d79605d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/BuildInterpretedExecutionPlan.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/BuildInterpretedExecutionPlan.scala @@ -24,7 +24,6 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.{Co import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.phases.CompilationState import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.Pipe -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.LogicalPlanIdentificationBuilder import org.neo4j.cypher.internal.compatibility.v3_3.runtime.profiler.Profiler import org.neo4j.cypher.internal.compiler.v3_3.CypherCompilerConfiguration import org.neo4j.cypher.internal.compiler.v3_3.phases._ @@ -46,15 +45,14 @@ object BuildInterpretedExecutionPlan extends Phase[CommunityRuntimeContext, Logi override def process(from: LogicalPlanState, context: CommunityRuntimeContext): CompilationState = { val logicalPlan = from.logicalPlan - val idMap = LogicalPlanIdentificationBuilder(logicalPlan) val converters = new ExpressionConverters(CommunityExpressionConverter) val executionPlanBuilder = new PipeExecutionPlanBuilder(context.clock, context.monitors, expressionConverters = converters, pipeBuilderFactory = CommunityPipeBuilderFactory) val pipeBuildContext = PipeExecutionBuilderContext(context.metrics.cardinality, from.semanticTable(), from.plannerName) - val pipeInfo = executionPlanBuilder.build(from.periodicCommit, logicalPlan, idMap)(pipeBuildContext, context.planContext) + val pipeInfo = executionPlanBuilder.build(from.periodicCommit, logicalPlan)(pipeBuildContext, context.planContext) val PipeInfo(pipe, updating, periodicCommitInfo, fp, planner) = pipeInfo val columns = from.statement().returnColumns - val resultBuilderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, columns, logicalPlan, idMap) + val resultBuilderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, columns, logicalPlan) val func = getExecutionPlanFunction(periodicCommitInfo, from.queryText, updating, resultBuilderFactory, context.notificationLogger, InterpretedRuntimeName) val execPlan = new ExecutionPlan { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/CommunityPipeBuilder.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/CommunityPipeBuilder.scala index d24392c1845f0..50d495b1ecbfc 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/CommunityPipeBuilder.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/CommunityPipeBuilder.scala @@ -21,12 +21,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.ExpressionConverters import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.PatternConverters._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{AggregationExpression, Literal, Expression => CommandExpression} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{AggregationExpression, Literal} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Predicate, True} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.builders.prepare.KeyTokenResolver import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3.spi.PlanContext import org.neo4j.cypher.internal.frontend.v3_3.ast._ import org.neo4j.cypher.internal.frontend.v3_3.helpers.Eagerly @@ -43,7 +42,7 @@ import org.neo4j.values.virtual.{EdgeValue, NodeValue} * When adding new Pipes and LogicalPlans, this is where you should be looking. */ case class CommunityPipeBuilder(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, - idMap: Map[LogicalPlan, Id], expressionConverters: ExpressionConverters, + expressionConverters: ExpressionConverters, rewriteAstExpression: (frontEndAst.Expression) => frontEndAst.Expression) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext) extends PipeBuilder { @@ -55,7 +54,7 @@ case class CommunityPipeBuilder(monitors: Monitors, recurse: LogicalPlan => Pipe def build(plan: LogicalPlan): Pipe = { - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId plan match { case SingleRow() => SingleRowPipe()(id) @@ -104,7 +103,7 @@ case class CommunityPipeBuilder(monitors: Monitors, recurse: LogicalPlan => Pipe } def build(plan: LogicalPlan, source: Pipe): Pipe = { - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId plan match { case Projection(_, expressions) => ProjectionPipe(source, Eagerly.immutableMapValues(expressions, buildExpression))(id = id) @@ -337,7 +336,7 @@ case class CommunityPipeBuilder(monitors: Monitors, recurse: LogicalPlan => Pipe } def build(plan: LogicalPlan, lhs: Pipe, rhs: Pipe): Pipe = { - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId plan match { case CartesianProduct(_, _) => CartesianProductPipe(lhs, rhs)(id = id) @@ -403,7 +402,6 @@ case class CommunityPipeBuilder(monitors: Monitors, recurse: LogicalPlan => Pipe } } - private val resolver = new KeyTokenResolver implicit val table: SemanticTable = context.semanticTable private def buildPredicate(expr: frontEndAst.Expression)(implicit context: PipeExecutionBuilderContext, planContext: PlanContext): Predicate = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeBuilderFactory.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeBuilderFactory.scala index f0214053a2062..35daf16dacaf0 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeBuilderFactory.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeBuilderFactory.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.ExpressionConverters import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{NestedPipeExpression, Pipe} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3.spi.PlanContext import org.neo4j.cypher.internal.compiler.v3_3.{ast => compilerAst} import org.neo4j.cypher.internal.frontend.v3_3.phases.Monitors @@ -33,7 +32,6 @@ trait PipeBuilderFactory { def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, - idMap: Map[LogicalPlan, Id], expressionConverters: ExpressionConverters) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext): PipeBuilder diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilder.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilder.scala index e3630aad36313..81406ea2581c2 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilder.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilder.scala @@ -24,7 +24,6 @@ import java.time.Clock import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.ExpressionConverters import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3.spi.{InstrumentedGraphStatistics, PlanContext} import org.neo4j.cypher.internal.frontend.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.phases.Monitors @@ -37,10 +36,10 @@ class PipeExecutionPlanBuilder(clock: Clock, monitors: Monitors, pipeBuilderFactory: PipeBuilderFactory, expressionConverters: ExpressionConverters) { - def build(periodicCommit: Option[PeriodicCommit], plan: LogicalPlan, idMap: Map[LogicalPlan, Id]) + def build(periodicCommit: Option[PeriodicCommit], plan: LogicalPlan) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext): PipeInfo = { - val topLevelPipe = buildPipe(plan, idMap) + val topLevelPipe = buildPipe(plan) val fingerprint = planContext.statistics match { case igs: InstrumentedGraphStatistics => @@ -73,12 +72,11 @@ class PipeExecutionPlanBuilder(clock: Clock, Next we pop out 'a', and this time we are coming from the LHS, and we can now pop two pipes from the pipe stack to build the pipe for 'a'. Thanks for reading this far - I didn't think we would make it! */ - private def buildPipe(plan: LogicalPlan, idMap: Map[LogicalPlan, Id])(implicit context: PipeExecutionBuilderContext, planContext: PlanContext): Pipe = { + private def buildPipe(plan: LogicalPlan)(implicit context: PipeExecutionBuilderContext, planContext: PlanContext): Pipe = { val pipeBuilder = pipeBuilderFactory( monitors = monitors, - recurse = p => buildPipe(p, idMap), + recurse = p => buildPipe(p), readOnly = plan.solved.all(_.queryGraph.readOnly), - idMap = idMap, expressionConverters = expressionConverters) val planStack = new mutable.Stack[LogicalPlan]() @@ -149,10 +147,10 @@ class PipeExecutionPlanBuilder(clock: Clock, object CommunityPipeBuilderFactory extends PipeBuilderFactory { def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, - readOnly: Boolean, idMap: Map[LogicalPlan, Id], + readOnly: Boolean, expressionConverters: ExpressionConverters) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext): CommunityPipeBuilder = { - CommunityPipeBuilder(monitors, recurse, readOnly, idMap, expressionConverters, recursePipes(recurse, planContext)) + CommunityPipeBuilder(monitors, recurse, readOnly, expressionConverters, recursePipes(recurse, planContext)) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/DefaultExecutionResultBuilderFactory.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/DefaultExecutionResultBuilderFactory.scala index 5e8ee679cda8b..5fd45bb75304d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/DefaultExecutionResultBuilderFactory.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/DefaultExecutionResultBuilderFactory.scala @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.InternalWrapping._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments.{Runtime, RuntimeImpl} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, InternalPlanDescription, LogicalPlan2PlanDescription} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{InternalPlanDescription, LogicalPlan2PlanDescription} import org.neo4j.cypher.internal.frontend.v3_3.phases.InternalNotificationLogger import org.neo4j.cypher.internal.frontend.v3_3.{CypherException, ProfilerStatisticsNotReadyException} import org.neo4j.cypher.internal.spi.v3_3.{CSVResources, QueryContext} @@ -35,8 +35,7 @@ import scala.collection.mutable case class DefaultExecutionResultBuilderFactory(pipeInfo: PipeInfo, columns: List[String], - logicalPlan: LogicalPlan, - idMap: Map[LogicalPlan, Id]) extends ExecutionResultBuilderFactory { + logicalPlan: LogicalPlan) extends ExecutionResultBuilderFactory { def create(): ExecutionResultBuilder = ExecutionWorkflowBuilder() @@ -91,7 +90,7 @@ case class DefaultExecutionResultBuilderFactory(pipeInfo: PipeInfo, runtimeName: RuntimeName): InternalExecutionResult = { val queryType: InternalQueryType = getQueryType val planDescription: InternalPlanDescription = - LogicalPlan2PlanDescription(logicalPlan, idMap, pipeInfo.plannerUsed) + LogicalPlan2PlanDescription(logicalPlan, pipeInfo.plannerUsed) .addArgument(Runtime(runtimeName.toTextOutput)) .addArgument(RuntimeImpl(runtimeName.name)) if (planType == ExplainMode) { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureCallExecutionPlan.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureCallExecutionPlan.scala index 04441d522beed..efba9695f09b9 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureCallExecutionPlan.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureCallExecutionPlan.scala @@ -29,8 +29,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{Execu import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.Counter import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{ExternalCSVResource, QueryState} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Argument, Id, NoChildren, PlanDescriptionImpl} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Argument, NoChildren, PlanDescriptionImpl} import org.neo4j.cypher.internal.compiler.v3_3.ProcedurePlannerName +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{GraphStatistics, PlanContext} import org.neo4j.cypher.internal.frontend.v3_3.ast.Expression import org.neo4j.cypher.internal.frontend.v3_3.notification.InternalNotification @@ -115,13 +116,13 @@ case class ProcedureCallExecutionPlan(signature: ProcedureSignature, } private def createNormalPlan = - PlanDescriptionImpl(new Id, "ProcedureCall", NoChildren, + PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ProcedureCall", NoChildren, arguments, resultSymbols.map(_._1).toSet ) private def createProfilePlanGenerator(rowCounter: Counter) = () => - PlanDescriptionImpl(new Id, "ProcedureCall", NoChildren, + PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ProcedureCall", NoChildren, Seq(createSignatureArgument, DbHits(1), Rows(rowCounter.counted)) ++ arguments, resultSymbols.map(_._1).toSet ) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/PureSideEffectExecutionPlan.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/PureSideEffectExecutionPlan.scala index 05844d8664553..d71770278c647 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/PureSideEffectExecutionPlan.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/PureSideEffectExecutionPlan.scala @@ -24,8 +24,9 @@ import org.neo4j.cypher.internal.InternalExecutionResult import org.neo4j.cypher.internal.compatibility.v3_3.runtime._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{ExecutionPlan, InternalQueryType, SCHEMA_WRITE} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, NoChildren, PlanDescriptionImpl} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{NoChildren, PlanDescriptionImpl} import org.neo4j.cypher.internal.compiler.v3_3._ +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{GraphStatistics, PlanContext} import org.neo4j.cypher.internal.frontend.v3_3.PlannerName import org.neo4j.cypher.internal.frontend.v3_3.notification.InternalNotification @@ -58,7 +59,7 @@ case class PureSideEffectExecutionPlan(name: String, queryType: InternalQueryTyp } } - private def description = PlanDescriptionImpl(new Id, name, NoChildren, + private def description = PlanDescriptionImpl(LogicalPlanId.DEFAULT, name, NoChildren, Seq(Planner(plannerUsed.toTextOutput), PlannerImpl(plannerUsed.name), Runtime(runtimeUsed.toTextOutput), diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala index 32112fb5b3d26..f83df9088e412 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.helpers.ValueUtils -case class AllNodesScanPipe(ident: String)(val id: Id = new Id) extends Pipe { +case class AllNodesScanPipe(ident: String)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val baseContext = state.createOrGetInitialContext() diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ApplyPipe.scala index ac02b3255c495..e72cc87b6a1b8 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ApplyPipe.scala @@ -20,9 +20,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class ApplyPipe(source: Pipe, inner: Pipe)(val id: Id = new Id) extends PipeWithSource(source) { +case class ApplyPipe(source: Pipe, inner: Pipe)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = input.flatMap { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ArgumentPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ArgumentPipe.scala index 0f633a756a789..9f326546627e1 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ArgumentPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ArgumentPipe.scala @@ -20,9 +20,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class ArgumentPipe()(val id: Id = new Id) extends Pipe { +case class ArgumentPipe()(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = Iterator(state.initialContext.get) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AssertSameNodePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AssertSameNodePipe.scala index 678c05a7199dc..165e301a62554 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AssertSameNodePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AssertSameNodePipe.scala @@ -21,12 +21,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.CastSupport -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.MergeConstraintConflictException import org.neo4j.values.virtual.NodeValue case class AssertSameNodePipe(source: Pipe, inner: Pipe, node: String) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(lhsResult: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CartesianProductPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CartesianProductPipe.scala index f5002d5196057..0fb8eccf06c87 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CartesianProductPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CartesianProductPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class CartesianProductPipe(lhs: Pipe, rhs: Pipe) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { for (outer <- lhs.createResults(state); inner <- rhs.createResults(state)) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConditionalApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConditionalApplyPipe.scala index de6f8c0c1ef9d..587b854c4bcaf 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConditionalApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConditionalApplyPipe.scala @@ -20,11 +20,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values case class ConditionalApplyPipe(source: Pipe, inner: Pipe, items: Seq[String], negated: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConstraintOperationPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConstraintOperationPipe.scala index 51dd446add4b9..030cc23d42bc3 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConstraintOperationPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ConstraintOperationPipe.scala @@ -23,10 +23,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.KeyToken import org.neo4j.cypher.internal.compiler.v3_3._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId class ConstraintOperationPipe(op: PropertyConstraintOperation, keyToken: KeyToken, propertyKey: KeyToken) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val keyTokenId = keyToken.getOrCreateId(state.query) val propertyKeyId = propertyKey.getOrCreateId(state.query) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala index a001815f1c148..ef90a98c77c5b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala @@ -25,7 +25,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InvalidSemanticsException} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.helpers.ValueUtils @@ -81,7 +81,7 @@ abstract class BaseCreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel] } case class CreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel], properties: Option[Expression]) - (val id: Id = new Id) extends BaseCreateNodePipe(src, key, labels, properties) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseCreateNodePipe(src, key, labels, properties) { override protected def handleNull(key: String) { // do nothing @@ -89,7 +89,7 @@ case class CreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel], proper } case class MergeCreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel], properties: Option[Expression]) - (val id: Id = new Id) extends BaseCreateNodePipe(src, key, labels, properties) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseCreateNodePipe(src, key, labels, properties) { override protected def handleNull(key: String) { //merge cannot use null properties, since in that case the match part will not find the result of the create throw new InvalidSemanticsException(s"Cannot merge node using null property value for $key") diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala index 1696fbc759261..0049c2c791454 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala @@ -25,7 +25,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InternalException, InvalidSemanticsException} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.helpers.ValueUtils @@ -87,7 +87,7 @@ abstract class BaseRelationshipPipe(src: Pipe, key: String, startNode: String, t case class CreateRelationshipPipe(src: Pipe, key: String, startNode: String, typ: LazyType, endNode: String, properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseRelationshipPipe(src, key, startNode, typ, endNode, properties) { override protected def handleNull(key: String) { //do nothing @@ -96,7 +96,7 @@ case class CreateRelationshipPipe(src: Pipe, case class MergeCreateRelationshipPipe(src: Pipe, key: String, startNode: String, typ: LazyType, endNode: String, properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseRelationshipPipe(src, key, startNode, typ, endNode, properties) { override protected def handleNull(key: String) { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DeletePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DeletePipe.scala index 42a9b2435b823..a382fbe17a17a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DeletePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DeletePipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.GraphElementPropertyFunctions -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue, PathValue} @@ -30,7 +30,7 @@ import org.neo4j.values.virtual.{EdgeValue, NodeValue, PathValue} import scala.collection.JavaConverters._ case class DeletePipe(src: Pipe, expression: Expression, forced: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(src) with GraphElementPropertyFunctions { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DirectedRelationshipByIdSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DirectedRelationshipByIdSeekPipe.scala index 4f909fd53f9ea..35237fdd4537e 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DirectedRelationshipByIdSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DirectedRelationshipByIdSeekPipe.scala @@ -23,7 +23,7 @@ import java.lang import java.util.function import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.VirtualValues @@ -31,7 +31,7 @@ import org.neo4j.values.virtual.VirtualValues import scala.collection.JavaConverters._ case class DirectedRelationshipByIdSeekPipe(ident: String, relIdExpr: SeekArgs, toNode: String, fromNode: String) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { relIdExpr.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DistinctPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DistinctPipe.scala index b41e621a7e1f0..e63ac1b989c88 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DistinctPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/DistinctPipe.scala @@ -20,8 +20,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, MapExecutionContext} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.helpers.Eagerly import org.neo4j.values.AnyValue import org.neo4j.values.virtual.VirtualValues @@ -29,7 +29,7 @@ import org.neo4j.values.virtual.VirtualValues import scala.collection.mutable case class DistinctPipe(source: Pipe, expressions: Map[String, Expression]) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { val keyNames: Seq[String] = expressions.keys.toIndexedSeq diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerAggregationPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerAggregationPipe.scala index a547583cbdcd3..f9fa31a48ac9d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerAggregationPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerAggregationPipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{AggregationExpression, Expression} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.aggregation.AggregationFunction -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.virtual.{ListValue, MapValue, VirtualValues} @@ -33,7 +33,7 @@ import scala.collection.mutable.{Map => MutableMap} // to emit aggregated results. // Cypher is lazy until it can't - this pipe will eagerly load the full match case class EagerAggregationPipe(source: Pipe, keyExpressions: Map[String, Expression], aggregations: Map[String, AggregationExpression]) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { aggregations.values.foreach(_.registerOwningPipe(this)) keyExpressions.values.foreach(_.registerOwningPipe(this)) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerPipe.scala index c6f08d8103686..8cca191cbdcce 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EagerPipe.scala @@ -20,9 +20,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class EagerPipe(src: Pipe)(val id: Id = new Id) +case class EagerPipe(src: Pipe)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(src) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EmptyResultPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EmptyResultPipe.scala index 8a4efeae13576..ec1dffe7f5599 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EmptyResultPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/EmptyResultPipe.scala @@ -20,9 +20,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class EmptyResultPipe(source: Pipe)(val id: Id = new Id) extends PipeWithSource(source) { +case class EmptyResultPipe(source: Pipe)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(input:Iterator[ExecutionContext], state: QueryState) = { while(input.hasNext) { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ErrorPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ErrorPipe.scala index 95b5c0db94413..014038f8eba80 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ErrorPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ErrorPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class ErrorPipe(source: Pipe, exception: Exception) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = throw exception diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala index cc39fb054ce1d..c022f8ffb4925 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.graphdb.Relationship import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} @@ -34,7 +34,7 @@ case class ExpandAllPipe(source: Pipe, toName: String, dir: SemanticDirection, types: LazyTypes) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.flatMap { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipe.scala index 9d76d995c54e0..a64edb6908569 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.InternalException import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue @@ -41,7 +41,7 @@ case class ExpandIntoPipe(source: Pipe, toName: String, dir: SemanticDirection, lazyTypes: LazyTypes) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with CachingExpandInto { self => private final val CACHE_SIZE = 100000 diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FilterPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FilterPipe.scala index cb628544b33df..7e65c05f62f8d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FilterPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FilterPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class FilterPipe(source: Pipe, predicate: Predicate) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { predicate.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ForeachPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ForeachPipe.scala index 9f7bb37ff5cc4..2ecda2dd3d773 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ForeachPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ForeachPipe.scala @@ -22,12 +22,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ListSupport -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id - +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import scala.collection.JavaConverters._ case class ForeachPipe(source: Pipe, inner: Pipe, variable: String, expression: Expression) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with ListSupport { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala index 1e0ee4fe162d4..1292a75253b45 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} @@ -34,7 +34,7 @@ case class FullPruningVarLengthExpandPipe(source: Pipe, min: Int, max: Int, filteringStep: VarLengthPredicate = VarLengthPredicate.NONE) - (val id: Id = new Id) extends PipeWithSource(source) with Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { self => assert(min <= max) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IndexOperationPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IndexOperationPipe.scala index 93a0d1f11c42d..9cc6116267647 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IndexOperationPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IndexOperationPipe.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.{CreateIndex, DropIndex, IndexOperation} import org.neo4j.cypher.internal.compiler.v3_3._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SyntaxException -case class IndexOperationPipe(indexOp: IndexOperation)(val id: Id = new Id) extends Pipe { +case class IndexOperationPipe(indexOp: IndexOperation)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val queryContext = state.query diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSelectOrSemiApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSelectOrSemiApplyPipe.scala index f0fed60a655d0..6a92fe40f7621 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSelectOrSemiApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSelectOrSemiApplyPipe.scala @@ -21,11 +21,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values case class LetSelectOrSemiApplyPipe(source: Pipe, inner: Pipe, letVarName: String, predicate: Predicate, negated: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { predicate.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSemiApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSemiApplyPipe.scala index 408486e87ead7..ab9e6e4b215d1 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSemiApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LetSemiApplyPipe.scala @@ -20,11 +20,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values case class LetSemiApplyPipe(source: Pipe, inner: Pipe, letVarName: String, negated: Boolean) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.map { (outerContext) => diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipe.scala index b4fdddb16a8ec..7891e32dceb47 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, NumericHelper} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class LimitPipe(source: Pipe, exp: Expression) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with NumericHelper { exp.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LoadCSVPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LoadCSVPipe.scala index e4ce04459a328..417dbb1d4f934 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LoadCSVPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LoadCSVPipe.scala @@ -24,7 +24,7 @@ import java.net.URL import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ArrayBackedMap -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.LoadExternalResourceException import org.neo4j.cypher.internal.ir.v3_3.{CSVFormat, HasHeaders, NoHeaders} import org.neo4j.cypher.internal.spi.v3_3.QueryContext @@ -40,7 +40,7 @@ case class LoadCSVPipe(source: Pipe, variable: String, fieldTerminator: Option[String], legacyCsvQuoteEscaping: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { urlExpression.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LockNodesPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LockNodesPipe.scala index 765c2c3fd1e69..180fb87dd8bd5 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LockNodesPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LockNodesPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.virtual.NodeValue -case class LockNodesPipe(src: Pipe, variablesToLock: Set[String])(val id: Id = new Id) +case class LockNodesPipe(src: Pipe, variablesToLock: Set[String])(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(src) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipe.scala index 4dfa7dc5c45e4..bee17d128bce8 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsList -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.virtual.{ListValue, VirtualValues} import scala.collection.JavaConverters._ @@ -60,7 +60,7 @@ case class ManySeekArgs(coll: Expression) extends SeekArgs { } case class NodeByIdSeekPipe(ident: String, nodeIdsExpr: SeekArgs) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { nodeIdsExpr.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala index 39ad1d426241c..fffd700bfdd6c 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala @@ -20,11 +20,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.helpers.ValueUtils case class NodeByLabelScanPipe(ident: String, label: LazyLabel) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeCountFromCountStorePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeCountFromCountStorePipe.scala index cd74560ec1b1c..253a4e50e2f45 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeCountFromCountStorePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeCountFromCountStorePipe.scala @@ -20,12 +20,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.NameId import org.neo4j.values.storable.Values case class NodeCountFromCountStorePipe(ident: String, labels: List[Option[LazyLabel]]) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val baseContext = state.createOrGetInitialContext() diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipe.scala index aaefca9a4d036..5c8a6f2adbe34 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue @@ -28,7 +28,7 @@ import org.neo4j.values.virtual.NodeValue import scala.collection.mutable case class NodeHashJoinPipe(nodeVariables: Set[String], left: Pipe, right: Pipe) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(left) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala index be2a26c3d4180..4f602f57364dc 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala @@ -21,8 +21,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} import org.neo4j.graphdb.Node @@ -62,7 +62,7 @@ case class NodeIndexContainsScanPipe(ident: String, label: LabelToken, propertyKey: PropertyKeyToken, valueExpr: Expression) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends AbstractNodeIndexStringScanPipe(ident, label, propertyKey, valueExpr) { override protected def queryContextCall(state: QueryState, indexDescriptor: IndexDescriptor, value: String) = @@ -73,7 +73,7 @@ case class NodeIndexEndsWithScanPipe(ident: String, label: LabelToken, propertyKey: PropertyKeyToken, valueExpr: Expression) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends AbstractNodeIndexStringScanPipe(ident, label, propertyKey, valueExpr) { override protected def queryContextCall(state: QueryState, indexDescriptor: IndexDescriptor, value: String) = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala index 81ceb43ec95e8..ec2a5c386b1dc 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala @@ -20,15 +20,15 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} import org.neo4j.helpers.ValueUtils case class NodeIndexScanPipe(ident: String, label: LabelToken, propertyKey: PropertyKeyToken) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val descriptor = IndexDescriptor(label.nameId.id, propertyKey.nameId.id) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala index 7964f5e301556..59f5b8c9c491a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala @@ -22,10 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.indexQuery -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.cypher.internal.v3_3.logical.plans.QueryExpression +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlanId, QueryExpression} import org.neo4j.helpers.ValueUtils.fromNodeProxy case class NodeIndexSeekPipe(ident: String, @@ -33,7 +32,7 @@ case class NodeIndexSeekPipe(ident: String, propertyKeys: Seq[PropertyKeyToken], valueExpr: QueryExpression[Expression], indexMode: IndexSeekMode = IndexSeek) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val propertyIds: Array[Int] = propertyKeys.map(_.nameId.id).toArray diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipe.scala index f45d0e109451e..6b2d34387fc86 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue @@ -29,7 +29,7 @@ import scala.collection.mutable import scala.collection.mutable.ListBuffer case class NodeOuterHashJoinPipe(nodeVariables: Set[String], source: Pipe, inner: Pipe, nullableVariables: Set[String]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { val nullColumns: Seq[(String, AnyValue)] = nullableVariables.map(_ -> Values.NO_VALUE).toSeq diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala index fca32bf4f72c7..876ba80ceee71 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue @@ -30,7 +30,7 @@ import org.neo4j.values.virtual.NodeValue case class OptionalExpandAllPipe(source: Pipe, fromName: String, relName: String, toName: String, dir: SemanticDirection, types: LazyTypes, predicate: Predicate) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { predicate.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipe.scala index 9d8a1e3ef111d..675b55e672972 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue @@ -30,7 +30,7 @@ import scala.collection.mutable.ListBuffer case class OptionalExpandIntoPipe(source: Pipe, fromName: String, relName: String, toName: String, dir: SemanticDirection, types: LazyTypes, predicate: Predicate) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with CachingExpandInto { private final val CACHE_SIZE = 100000 diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalPipe.scala index b70e6ecaa08e0..59b47e787e906 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalPipe.scala @@ -20,11 +20,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values case class OptionalPipe(nullableVariables: Set[String], source: Pipe) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { private def notFoundExecutionContext(initialContext: Option[ExecutionContext]): ExecutionContext = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/Pipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/Pipe.scala index 77f2d6750328c..d723c24941231 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/Pipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/Pipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId /** * Pipe is a central part of Cypher. Most pipes are decorators - they @@ -45,10 +45,10 @@ trait Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] // Used by profiling to identify where to report dbhits and rows - def id: Id + def id: LogicalPlanId } -case class SingleRowPipe()(val id: Id = new Id) extends Pipe { +case class SingleRowPipe()(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { def internalCreateResults(state: QueryState) = Iterator(state.createOrGetInitialContext()) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProcedureCallPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProcedureCallPipe.scala index 60fb4255ac2d4..d7881c5718f99 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProcedureCallPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProcedureCallPipe.scala @@ -23,13 +23,13 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.ProcedureCallMode import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ValueConversion -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType import org.neo4j.cypher.internal.v3_3.logical.plans.ProcedureSignature import org.neo4j.values.AnyValue object ProcedureCallRowProcessing { - def apply(signature: ProcedureSignature) = + def apply(signature: ProcedureSignature): ProcedureCallRowProcessing = if (signature.isVoid) PassThroughRow else FlatMapAndAppendToRow } @@ -45,7 +45,7 @@ case class ProcedureCallPipe(source: Pipe, rowProcessing: ProcedureCallRowProcessing, resultSymbols: Seq[(String, CypherType)], resultIndices: Seq[(Int, String)]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProduceResultsPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProduceResultsPipe.scala index 6f77e8c426df6..3ecfb8b9a70c6 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProduceResultsPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProduceResultsPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class ProduceResultsPipe(source: Pipe, columns: Seq[String]) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState) = { // do not register this pipe as parent as it does not do anything except filtering of already fetched // key-value pairs and thus should not have any stats diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipe.scala index 593c5dc12f1f3..293f27d414ce3 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ListSupport -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.values.virtual.VirtualValues.reverse import org.neo4j.values.virtual.{EdgeValue, ListValue, NodeValue} @@ -30,7 +30,7 @@ case class ProjectEndpointsPipe(source: Pipe, relName: String, start: String, startInScope: Boolean, end: String, endInScope: Boolean, relTypes: Option[LazyTypes], directed: Boolean, simpleLength: Boolean) - (val id: Id = new Id) extends PipeWithSource(source) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with ListSupport { type Projector = (ExecutionContext) => Iterator[ExecutionContext] diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectionPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectionPipe.scala index 2228174e24004..f1ea70f9cddc3 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectionPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectionPipe.scala @@ -21,14 +21,14 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId /* Projection evaluates expressions and stores their values into new slots in the execution context. It's an additive operation - nothing is lost in the execution context, the pipe simply adds new key-value pairs. */ case class ProjectionPipe(source: Pipe, expressions: Map[String, Expression]) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { expressions.values.foreach(_.registerOwningPipe(this)) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala index 7441ffaa1f1b1..9eeddd9adbbf0 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} @@ -34,7 +34,7 @@ case class PruningVarLengthExpandPipe(source: Pipe, min: Int, max: Int, filteringStep: VarLengthPredicate = VarLengthPredicate.NONE) - (val id: Id = new Id) extends PipeWithSource(source) with Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { self => assert(min <= max) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RelationshipCountFromCountStorePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RelationshipCountFromCountStorePipe.scala index 9fdced8ad95c1..877c8d642f978 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RelationshipCountFromCountStorePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RelationshipCountFromCountStorePipe.scala @@ -20,13 +20,13 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.NameId import org.neo4j.values.storable.Values case class RelationshipCountFromCountStorePipe(ident: String, startLabel: Option[LazyLabel], typeNames: LazyTypes, endLabel: Option[LazyLabel]) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val maybeStartLabelId = getLabelId(startLabel, state) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RemoveLabelsPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RemoveLabelsPipe.scala index 4dae54ed3a05d..3a6000c9ab41a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RemoveLabelsPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RemoveLabelsPipe.scala @@ -22,12 +22,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.CastSupport import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.GraphElementPropertyFunctions -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue case class RemoveLabelsPipe(src: Pipe, variable: String, labels: Seq[LazyLabel]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(src) with GraphElementPropertyFunctions { override protected def internalCreateResults(input: Iterator[ExecutionContext], diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RollUpApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RollUpApplyPipe.scala index 66dfc9a5cf2c7..91c75439a2236 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RollUpApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/RollUpApplyPipe.scala @@ -20,12 +20,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values.NO_VALUE import org.neo4j.values.virtual.VirtualValues case class RollUpApplyPipe(lhs: Pipe, rhs: Pipe, collectionName: String, identifierToCollect: String, nullableIdentifiers: Set[String]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(lhs) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState) = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SelectOrSemiApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SelectOrSemiApplyPipe.scala index 35e4b7fff6613..f0db1e8681865 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SelectOrSemiApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SelectOrSemiApplyPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class SelectOrSemiApplyPipe(source: Pipe, inner: Pipe, predicate: Predicate, negated: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { predicate.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SemiApplyPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SemiApplyPipe.scala index 8fe209b42d447..2b8940f50e9d7 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SemiApplyPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SemiApplyPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class SemiApplyPipe(source: Pipe, inner: Pipe, negated: Boolean) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.filter { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SetPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SetPipe.scala index ea4a83b93ef50..cb8425ab9288d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SetPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SetPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class SetPipe(src: Pipe, setOperation: SetOperation) - (val id: Id = new Id) extends PipeWithSource(src) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(src) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.map { row => diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ShortestPathPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ShortestPathPipe.scala index 8ede0b99bbd3f..4a4495ab6d6fd 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ShortestPathPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ShortestPathPipe.scala @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.ShortestPath import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.ShortestPathExpression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{ListValue, PathValue, VirtualValues} @@ -35,7 +35,7 @@ import scala.collection.JavaConverters._ */ case class ShortestPathPipe(source: Pipe, shortestPathCommand: ShortestPath, predicates: Seq[Predicate] = Seq.empty, withFallBack: Boolean = false, disallowSameNode: Boolean = true) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { private def pathName = shortestPathCommand.pathName private val shortestPathExpression = ShortestPathExpression(shortestPathCommand, predicates, withFallBack, disallowSameNode) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SkipPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SkipPipe.scala index 8d47bcc18fdee..bc4fcfdccffc0 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SkipPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SkipPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, NumericHelper} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class SkipPipe(source: Pipe, exp: Expression) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with NumericHelper { exp.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SortPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SortPipe.scala index 51890ac81c758..939f25e05eb3b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SortPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/SortPipe.scala @@ -22,11 +22,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import java.util.Comparator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.{AnyValue, AnyValues} case class SortPipe(source: Pipe, orderBy: Seq[ColumnOrder]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { assert(orderBy.nonEmpty) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala index 541d60dc035c4..fb75e1ebd179b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{Effects, ReadsAllNodes} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} import org.neo4j.helpers.ValueUtils @@ -47,7 +47,7 @@ case class NodeStartPipe(source: Pipe, name: String, createSource: EntityProducer[Node], itemEffects: Effects = Effects(ReadsAllNodes)) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends StartPipe[Node](source, name, createSource) { def variableType = CTNode @@ -55,7 +55,7 @@ case class NodeStartPipe(source: Pipe, } case class RelationshipStartPipe(source: Pipe, name: String, createSource: EntityProducer[Relationship]) - (val id: Id = new Id) extends StartPipe[Relationship](source, name, createSource) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends StartPipe[Relationship](source, name, createSource) { def variableType = CTRelationship override def asAnyValue(in: Relationship): AnyValue = ValueUtils.fromRelationshipProxy(in) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipe.scala index 816bc14d4227f..3cc066fb7ef4b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipe.scala @@ -23,7 +23,7 @@ import java.util.Comparator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.storable.NumberValue @@ -66,7 +66,7 @@ abstract class TopPipe(source: Pipe, sortDescription: List[ColumnOrder]) } case class TopNPipe(source: Pipe, sortDescription: List[ColumnOrder], countExpression: Expression) - (val id: Id = new Id) extends TopPipe(source, sortDescription) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopPipe(source, sortDescription) { countExpression.registerOwningPipe(this) @@ -124,7 +124,7 @@ case class TopNPipe(source: Pipe, sortDescription: List[ColumnOrder], countExpre * an array, instead just store a single value. */ case class Top1Pipe(source: Pipe, sortDescription: List[ColumnOrder]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopPipe(source, sortDescription) { protected override def internalCreateResults(input: Iterator[ExecutionContext], @@ -156,7 +156,7 @@ case class Top1Pipe(source: Pipe, sortDescription: List[ColumnOrder]) * Special case for when we only want one element, and all others that have the same value (tied for first place) */ case class Top1WithTiesPipe(source: Pipe, sortDescription: List[ColumnOrder]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopPipe(source, sortDescription) { protected override def internalCreateResults(input: Iterator[ExecutionContext], diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipe.scala index f8fd2a41c5796..e260d9f2111c7 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.collection.primitive.{Primitive, PrimitiveLongSet} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue @@ -30,7 +30,7 @@ import scala.collection.mutable.ListBuffer import scala.collection.{AbstractIterator, Iterator} case class TriadicSelectionPipe(positivePredicate: Boolean, left: Pipe, source: String, seen: String, target: String, right: Pipe) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(left) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState) = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedRelationshipByIdSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedRelationshipByIdSeekPipe.scala index 21678f069fc33..a03fd0a092b99 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedRelationshipByIdSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedRelationshipByIdSeekPipe.scala @@ -23,8 +23,7 @@ import java.lang import java.util.function import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id -import org.neo4j.cypher.internal.compiler.v3_3.helpers.ListSupport +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.VirtualValues @@ -32,7 +31,7 @@ import org.neo4j.values.virtual.VirtualValues import scala.collection.JavaConverters._ case class UndirectedRelationshipByIdSeekPipe(ident: String, relIdExpr: SeekArgs, toNode: String, fromNode: String) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { relIdExpr.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnionPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnionPipe.scala index 88377f09941ad..4387138056f55 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnionPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnionPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class UnionPipe(l: Pipe, r: Pipe) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = l.createResults(state) ++ r.createResults(state) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnwindPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnwindPipe.scala index 7d0c42a587da9..59a7b5b7b74e0 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnwindPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UnwindPipe.scala @@ -22,14 +22,14 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ListSupport -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import scala.annotation.tailrec import scala.collection.JavaConverters._ case class UnwindPipe(source: Pipe, collection: Expression, variable: String) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with ListSupport { collection.registerOwningPipe(this) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ValueHashJoinPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ValueHashJoinPipe.scala index 4429bc187960e..8a8617b7b5b61 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ValueHashJoinPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ValueHashJoinPipe.scala @@ -21,14 +21,14 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import scala.collection.mutable case class ValueHashJoinPipe(lhsExpression: Expression, rhsExpression: Expression, left: Pipe, right: Pipe) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(left) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala index dc3dcaae8d066..2d95271b159ad 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.Values @@ -53,7 +53,7 @@ case class VarLengthExpandPipe(source: Pipe, max: Option[Int], nodeInScope: Boolean, filteringStep: VarLengthPredicate= VarLengthPredicate.NONE) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { private def varLengthExpand(node: NodeValue, state: QueryState, maxDepth: Option[Int], row: ExecutionContext): Iterator[(NodeValue, Seq[EdgeValue])] = { val stack = new mutable.Stack[(NodeValue, Seq[EdgeValue])] diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescription.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescription.scala index 4edc083cffba0..0055df5ca1dab 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescription.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescription.scala @@ -25,7 +25,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.exceptionHandler import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments._ import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection, ast} -import org.neo4j.cypher.internal.v3_3.logical.plans.{QualifiedName, SeekableArgs} +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlanId, QualifiedName, SeekableArgs} import org.neo4j.graphdb.ExecutionPlanDescription import org.neo4j.graphdb.ExecutionPlanDescription.ProfilerStatistics @@ -37,7 +37,7 @@ sealed trait InternalPlanDescription extends org.neo4j.graphdb.ExecutionPlanDesc def arguments: Seq[Argument] - def id: Id + def id: LogicalPlanId def name: String @@ -110,8 +110,6 @@ sealed trait InternalPlanDescription extends org.neo4j.graphdb.ExecutionPlanDesc } -class Id - sealed abstract class Argument extends Product { def name = productPrefix @@ -252,7 +250,7 @@ final case class TwoChildren(lhs: InternalPlanDescription, rhs: InternalPlanDesc def map(f: InternalPlanDescription => InternalPlanDescription) = TwoChildren(lhs = lhs.map(f), rhs = rhs.map(f)) } -final case class PlanDescriptionImpl(id: Id, +final case class PlanDescriptionImpl(id: LogicalPlanId, name: String, children: Children, arguments: Seq[Argument], @@ -349,7 +347,7 @@ final case class CompactedPlanDescription(similar: Seq[InternalPlanDescription]) override def find(name: String): Seq[InternalPlanDescription] = similar.last.find(name) - override def id: Id = similar.last.id + override def id: LogicalPlanId = similar.last.id override def addArgument(argument: Argument): InternalPlanDescription = ??? @@ -359,7 +357,9 @@ final case class CompactedPlanDescription(similar: Seq[InternalPlanDescription]) } -final case class SingleRowPlanDescription(id: Id, arguments: Seq[Argument] = Seq.empty, variables: Set[String]) +final case class SingleRowPlanDescription(id: LogicalPlanId, + arguments: Seq[Argument] = Seq.empty, + variables: Set[String]) extends InternalPlanDescription { def children = NoChildren @@ -385,7 +385,7 @@ final case class LegacyPlanDescription(name: String, stringRep: String ) extends InternalPlanDescription { - override def id: Id = new Id + override def id: LogicalPlanId = LogicalPlanId.DEFAULT override def children: Children = NoChildren diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescription.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescription.scala index 3df11431a08af..73d125c2befb1 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescription.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescription.scala @@ -28,25 +28,25 @@ import org.neo4j.cypher.internal.ir.v3_3.IdName import org.neo4j.cypher.internal.v3_3.logical.plans import org.neo4j.cypher.internal.v3_3.logical.plans._ -object LogicalPlan2PlanDescription extends ((LogicalPlan, Map[LogicalPlan, Id], PlannerName) => InternalPlanDescription) { +object LogicalPlan2PlanDescription extends ((LogicalPlan, PlannerName) => InternalPlanDescription) { - override def apply(input: LogicalPlan, idMap: Map[LogicalPlan, Id], + override def apply(input: LogicalPlan, plannerName: PlannerName): InternalPlanDescription = { val readOnly = input.solved.readOnly - new LogicalPlan2PlanDescription(idMap, readOnly).create(input) + new LogicalPlan2PlanDescription(readOnly).create(input) .addArgument(Version("CYPHER 3.3")) .addArgument(Planner(plannerName.toTextOutput)) .addArgument(PlannerImpl(plannerName.name)) } } -case class LogicalPlan2PlanDescription(idMap: Map[LogicalPlan, Id], readOnly: Boolean) +case class LogicalPlan2PlanDescription(readOnly: Boolean) extends TreeBuilder[InternalPlanDescription] { override protected def build(plan: LogicalPlan): InternalPlanDescription = { assert(plan.isLeaf) - val id = idMap(plan) + val id = plan.assignedId val variables = plan.availableSymbols.map(_.name) val result: InternalPlanDescription = plan match { @@ -120,7 +120,7 @@ case class LogicalPlan2PlanDescription(idMap: Map[LogicalPlan, Id], readOnly: Bo assert(plan.lhs.nonEmpty) assert(plan.rhs.isEmpty) - val id = idMap(plan) + val id = plan.assignedId val variables = plan.availableSymbols.map(_.name) val children = if (source.isInstanceOf[SingleRowPlanDescription]) NoChildren else SingleChild(source) @@ -153,17 +153,17 @@ case class LogicalPlan2PlanDescription(idMap: Map[LogicalPlan, Id], readOnly: Bo case _: EmptyResult => PlanDescriptionImpl(id, "EmptyResult", children, Seq.empty, variables) case NodeCountFromCountStore(IdName(id), labelName, arguments) => - PlanDescriptionImpl(id = idMap(plan), "NodeCountFromCountStore", NoChildren, + PlanDescriptionImpl(id = plan.assignedId, "NodeCountFromCountStore", NoChildren, Seq(CountNodesExpression(id, labelName.map(l => l.map(_.name)))), variables) case RelationshipCountFromCountStore(IdName(id), start, types, end, arguments) => - PlanDescriptionImpl(id = idMap(plan), "RelationshipCountFromCountStore", NoChildren, + PlanDescriptionImpl(id = plan.assignedId, "RelationshipCountFromCountStore", NoChildren, Seq( CountRelationshipsExpression(id, start.map(_.name), types.map(_.name), end.map(_.name))), variables) case NodeUniqueIndexSeek(IdName(id), label, propKeys, value, arguments) => - PlanDescriptionImpl(id = idMap(plan), "NodeUniqueIndexSeek", NoChildren, + PlanDescriptionImpl(id = plan.assignedId, "NodeUniqueIndexSeek", NoChildren, Seq(Index(label.name, propKeys.map(_.name))), variables) case _: ErrorPlan => @@ -294,7 +294,7 @@ case class LogicalPlan2PlanDescription(idMap: Map[LogicalPlan, Id], readOnly: Bo assert(plan.lhs.nonEmpty) assert(plan.rhs.nonEmpty) - val id = idMap(plan) + val id = plan.assignedId val variables = plan.availableSymbols.map(_.name) val children = TwoChildren(lhs, rhs) @@ -327,7 +327,7 @@ case class LogicalPlan2PlanDescription(idMap: Map[LogicalPlan, Id], readOnly: Bo PlanDescriptionImpl(id, "LetSelectOrSemiApply", children, Seq(Expression(predicate)), variables) case row: SingleRow => - SingleRowPlanDescription(id = idMap(plan), Seq.empty, row.argumentIds.map(_.name)) + SingleRowPlanDescription(id = plan.assignedId, Seq.empty, row.argumentIds.map(_.name)) case LetSelectOrAntiSemiApply(_, _, _, predicate) => PlanDescriptionImpl(id, "LetSelectOrSemiApply", children, Seq(Expression(predicate)), variables) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilder.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilder.scala deleted file mode 100644 index 899e8c1951baf..0000000000000 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilder.scala +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002-2017 "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.compatibility.v3_3.runtime.planDescription - -import org.neo4j.cypher.internal.frontend.v3_3.IdentityMap -import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlan, TreeBuilder} - -/* -The map of logical plan and ids is used to allow profiling to connect to the right part in the logical plan -to report db hits and rows passed through. - */ -object LogicalPlanIdentificationBuilder extends (LogicalPlan => Map[LogicalPlan, Id]) { - def apply(plan: LogicalPlan): Map[LogicalPlan, Id] = { - - val builder = new IdAssigner - builder.mapIds(plan) - } - - private class IdAssigner extends TreeBuilder[Map[LogicalPlan, Id]] { - def mapIds(plan: LogicalPlan): Map[LogicalPlan, Id] = create(plan) - - override protected def build(plan: LogicalPlan): Map[LogicalPlan, Id] = IdentityMap(plan -> new Id) - - override protected def build(plan: LogicalPlan, source: Map[LogicalPlan, Id]): Map[LogicalPlan, Id] = source + (plan -> new Id) - - override protected def build(plan: LogicalPlan, lhs: Map[LogicalPlan, Id], rhs: Map[LogicalPlan, Id]): Map[LogicalPlan, Id] = lhs ++ rhs + (plan -> new Id) - } -} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/Profiler.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/Profiler.scala index ffd08b5badc9a..4426b7bd2a2fb 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/Profiler.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/Profiler.scala @@ -23,8 +23,9 @@ import org.neo4j.collection.primitive.PrimitiveLongIterator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeDecorator, QueryState} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, InternalPlanDescription} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.spi.v3_3.{DelegatingOperations, DelegatingQueryContext, Operations, QueryContext} import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} import org.neo4j.helpers.MathUtil @@ -37,9 +38,9 @@ import scala.collection.mutable class Profiler(databaseInfo: DatabaseInfo = DatabaseInfo.COMMUNITY) extends PipeDecorator { outerProfiler => - val pageCacheStats: mutable.Map[Id, (Long, Long)] = mutable.Map.empty - val dbHitsStats: mutable.Map[Id, ProfilingPipeQueryContext] = mutable.Map.empty - val rowStats: mutable.Map[Id, ProfilingIterator] = mutable.Map.empty + val pageCacheStats: mutable.Map[LogicalPlanId, (Long, Long)] = mutable.Map.empty + val dbHitsStats: mutable.Map[LogicalPlanId, ProfilingPipeQueryContext] = mutable.Map.empty + val rowStats: mutable.Map[LogicalPlanId, ProfilingIterator] = mutable.Map.empty private var parentPipe: Option[Pipe] = None @@ -66,7 +67,7 @@ class Profiler(databaseInfo: DatabaseInfo = DatabaseInfo.COMMUNITY) extends Pipe state.withQueryContext(decoratedContext) } - private def updatePageCacheStatistics(pipeId: Id) = { + private def updatePageCacheStatistics(pipeId: LogicalPlanId) = { val context = dbHitsStats(pipeId) val statisticProvider = context.transactionalContext.kernelStatisticProvider val currentStat = pageCacheStats(pipeId) @@ -173,8 +174,9 @@ final class ProfilingPipeQueryContext(inner: QueryContext, val p: Pipe) override def relationshipOps: Operations[Relationship] = new ProfilerOperations(inner.relationshipOps) } -class ProfilingIterator(inner: Iterator[ExecutionContext], startValue: Long, pipeId: Id, - updatePageCacheStatistics:Id => Unit) extends Iterator[ExecutionContext] with Counter { +class ProfilingIterator(inner: Iterator[ExecutionContext], startValue: Long, pipeId: LogicalPlanId, + updatePageCacheStatistics: LogicalPlanId => Unit) extends Iterator[ExecutionContext] + with Counter { _count = startValue diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/RewindableExecutionResult.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/RewindableExecutionResult.scala index 01f0da7e4bc9f..76f8310ed7a86 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/RewindableExecutionResult.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/RewindableExecutionResult.scala @@ -39,7 +39,7 @@ import org.neo4j.cypher.internal.frontend.v3_2.{SemanticDirection => SemanticDir import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_3.{InputPosition, symbols} import org.neo4j.cypher.internal.javacompat.ExecutionResult -import org.neo4j.cypher.internal.v3_3.logical.plans.QualifiedName +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlanId, QualifiedName} import org.neo4j.cypher.result.QueryResult.QueryResultVisitor import org.neo4j.graphdb.Result.ResultVisitor import org.neo4j.graphdb.{Notification, QueryExecutionType, ResourceIterator, Result} @@ -228,7 +228,7 @@ object RewindableExecutionResult { case v2_3.planDescription.InternalPlanDescription.Arguments.SourceCode(className, sourceCode) => Arguments.SourceCode(className, sourceCode) } - PlanDescriptionImpl(new Id, name, children, arguments, planDescription.identifiers) + PlanDescriptionImpl(LogicalPlanId.DEFAULT, name, children, arguments, planDescription.identifiers) } @@ -352,7 +352,7 @@ object RewindableExecutionResult { val procName = QualifiedName(procedureName.namespace, procedureName.name) Arguments.Signature(procName, Seq.empty, results.map(pair => (pair._1, lift(pair._2)))) } - PlanDescriptionImpl(new Id, name, children, arguments, planDescription.variables) + PlanDescriptionImpl(LogicalPlanId.DEFAULT, name, children, arguments, planDescription.variables) } override def close(): Unit = inner.close() @@ -490,7 +490,7 @@ object RewindableExecutionResult { val procName = QualifiedName(procedureName.namespace, procedureName.name) Arguments.Signature(procName, Seq.empty, results.map(pair => (pair._1, lift(pair._2)))) } - PlanDescriptionImpl(new Id, name, children, arguments, planDescription.variables) + PlanDescriptionImpl(LogicalPlanId.DEFAULT, name, children, arguments, planDescription.variables) } override def close(): Unit = inner.close() diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderIT.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderIT.scala index 83c115cf26d49..31680e48ef566 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderIT.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderIT.scala @@ -30,7 +30,6 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.Toke import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.{expressions => legacy} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.PipeInfo import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.FakeIdMap import org.neo4j.cypher.internal.compiler.v3_3.planner._ import org.neo4j.cypher.internal.compiler.v3_3.planner.logical.Metrics import org.neo4j.cypher.internal.compiler.v3_3.planner.logical.Metrics.QueryGraphSolverInput @@ -56,9 +55,10 @@ class PipeExecutionPlanBuilderIT extends CypherFunSuite with LogicalPlanningTest new PipeExecutionPlanBuilder(Clock.systemUTC(), monitors, expressionConverters = converters, pipeBuilderFactory = CommunityPipeBuilderFactory) } - def build(f: PlannerQuery with CardinalityEstimation => LogicalPlan): PipeInfo = { + private def build(f: PlannerQuery with CardinalityEstimation => LogicalPlan): PipeInfo = { val logicalPlan = f(solved) - planBuilder.build(None, logicalPlan, new FakeIdMap) + logicalPlan.assignIds() + planBuilder.build(None, logicalPlan) } test("projection only query") { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderTest.scala index 831eeea560ce0..d06af5ad0ebe7 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/PipeExecutionPlanBuilderTest.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.{CommunityExpressionConverter, ExpressionConverters} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{FakePipe, Pipe} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{FakeIdMap, Id} import org.neo4j.cypher.internal.compiler.v3_3.spi.PlanContext import org.neo4j.cypher.internal.frontend.v3_3.phases.Monitors import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite @@ -68,7 +67,7 @@ class PipeExecutionPlanBuilderTest extends CypherFunSuite { val factory = new PipeBuilderFactory { - override def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, idMap: Map[LogicalPlan, Id], expressionConverters: ExpressionConverters) + override def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, expressionConverters: ExpressionConverters) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext) = new PipeBuilder { def build(plan: LogicalPlan) = plan match { case LeafPlan(n) => LeafPipe(n) @@ -96,7 +95,7 @@ class PipeExecutionPlanBuilderTest extends CypherFunSuite { val plan = LeafPlan("a") val expectedPipe = LeafPipe("a") - val result = builder.build(None, plan, new FakeIdMap).pipe + val result = builder.build(None, plan).pipe result should equal(expectedPipe) } @@ -122,7 +121,7 @@ class PipeExecutionPlanBuilderTest extends CypherFunSuite { ) ) - val result = builder.build(None, plan, new FakeIdMap).pipe + val result = builder.build(None, plan).pipe result should equal(expectedPipe) } @@ -151,7 +150,7 @@ class PipeExecutionPlanBuilderTest extends CypherFunSuite { ) ) - val result = builder.build(None, plan, new FakeIdMap).pipe + val result = builder.build(None, plan).pipe result should equal(expectedPipe) } @@ -172,7 +171,7 @@ class PipeExecutionPlanBuilderTest extends CypherFunSuite { OneChildPipe("b", LeafPipe("d")), TwoChildPipe("c", LeafPipe("e"), LeafPipe("f"))) - val result = builder.build(None, plan, new FakeIdMap).pipe + val result = builder.build(None, plan).pipe result should equal(expectedPipe) } } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/ExecutionWorkflowBuilderTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/ExecutionWorkflowBuilderTest.scala index e6f23731a867c..e64a65fb144cb 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/ExecutionWorkflowBuilderTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/ExecutionWorkflowBuilderTest.scala @@ -22,7 +22,6 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan import org.mockito.Matchers._ import org.mockito.Mockito._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.Pipe -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.FakeIdMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{EagerResultIterator, _} import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.phases.devNullLogger @@ -35,7 +34,11 @@ import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP class ExecutionWorkflowBuilderTest extends CypherFunSuite { val PlannerName = IDPPlannerName val solved = CardinalityEstimation.lift(PlannerQuery.empty, Cardinality(1)) - val logicalPlan = SingleRow()(solved) + val logicalPlan = { + val x = SingleRow()(solved) + x.assignIds() + x + } test("produces eager results for updating queries") { // GIVEN @@ -45,7 +48,7 @@ class ExecutionWorkflowBuilderTest extends CypherFunSuite { when(context.transactionalContext).thenReturn(mock[QueryTransactionalContext]) val pipeInfo = PipeInfo(pipe, updating = true, None, None, PlannerName) - val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan, new FakeIdMap) + val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan) // WHEN val builder = builderFactory.create() @@ -63,7 +66,7 @@ class ExecutionWorkflowBuilderTest extends CypherFunSuite { when(pipe.createResults(any())).thenReturn(Iterator.empty) val context = mock[QueryContext] val pipeInfo = PipeInfo(pipe, updating = false, None, None, PlannerName) - val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan, new FakeIdMap) + val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan) // WHEN val builder = builderFactory.create() @@ -82,7 +85,7 @@ class ExecutionWorkflowBuilderTest extends CypherFunSuite { val context = mock[QueryContext] when(context.transactionalContext).thenReturn(mock[QueryTransactionalContext]) val pipeInfo = PipeInfo(pipe, updating = false, None, None, PlannerName) - val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan, new FakeIdMap) + val builderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, List.empty, logicalPlan) // WHEN val builder = builderFactory.create() diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala index 8239d5a886e9d..e9d339bf4877d 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType import org.neo4j.helpers.ValueUtils import org.scalatest.mock.MockitoSugar @@ -34,5 +34,5 @@ class FakePipe(val data: Iterator[Map[String, Any]], newVariables: (String, Cyph def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = data.map(m => ExecutionContext(collection.mutable.Map(m.mapValues(ValueUtils.of).toSeq: _*))) - var id = new Id + var id = LogicalPlanId.DEFAULT } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipeTest.scala index 5785c813fa2b9..45f967e83125e 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/LimitPipeTest.scala @@ -23,7 +23,7 @@ import org.mockito.Mockito._ import org.mockito.internal.stubbing.defaultanswers.ReturnsMocks import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Literal -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite class LimitPipeTest extends CypherFunSuite { @@ -47,7 +47,7 @@ class LimitPipeTest extends CypherFunSuite { class DummyPipe(inputIterator: Iterator[ExecutionContext]) extends Pipe { override protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = ??? - override def id: Id = ??? + override def id: LogicalPlanId = ??? override def createResults(state: QueryState): Iterator[ExecutionContext] = inputIterator } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala index 70c0b7e040143..f202d3f9e2c76 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala @@ -24,7 +24,7 @@ import org.mockito.Mockito._ import org.mockito.invocation.InvocationOnMock import org.mockito.stubbing.Answer import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CypherType, _} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherTestSupport @@ -41,7 +41,7 @@ trait PipeTestSupport extends CypherTestSupport with MockitoSugar { protected def internalCreateResults(state: QueryState) = f(state) // Used by profiling to identify where to report dbhits and rows - override def id: Id = new Id + override def id: LogicalPlanId = LogicalPlanId.DEFAULT } def row(values: (String, Any)*) = ExecutionContext.from(values.map(v => (v._1, ValueUtils.of(v._2))): _*) diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/FakeIdMap.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/FakeIdMap.scala deleted file mode 100644 index 5fc94710e0efb..0000000000000 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/FakeIdMap.scala +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002-2017 "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.compatibility.v3_3.runtime.planDescription - -import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlan - -class FakeIdMap extends Map[LogicalPlan, Id] { - override def +[B1 >: Id](kv: (LogicalPlan, B1)): Map[LogicalPlan, B1] = ??? - - override def get(key: LogicalPlan): Option[Id] = Some(new Id) - - override def iterator: Iterator[(LogicalPlan, Id)] = ??? - - override def -(key: LogicalPlan): Map[LogicalPlan, Id] = ??? -} diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescriptionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescriptionTest.scala index 908ec0b61a76b..3b6f6ba6883fd 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescriptionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/InternalPlanDescriptionTest.scala @@ -19,11 +19,12 @@ */ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite class InternalPlanDescriptionTest extends CypherFunSuite { - private val ID = new Id + private val ID = LogicalPlanId.DEFAULT test("flatten behaves like expected for plan with two children") { val child1 = PlanDescriptionImpl(ID, "child1", NoChildren, Seq.empty, Set()) diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescriptionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescriptionTest.scala index 964d32865fdd0..e1eb9a43aa8ad 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescriptionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlan2PlanDescriptionTest.scala @@ -36,13 +36,13 @@ class LogicalPlan2PlanDescriptionTest extends CypherFunSuite with TableDrivenPro CardinalityEstimation.lift(PlannerQuery.empty, Cardinality(i)) val lhsLP = AllNodesScan(IdName("a"), Set.empty)(2) - val lhsPD = PlanDescriptionImpl(new Id, "AllNodesScan", NoChildren, Seq(EstimatedRows(2)), Set("a")) + val lhsPD = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "AllNodesScan", NoChildren, Seq(EstimatedRows(2)), Set("a")) - val rhsPD = PlanDescriptionImpl(new Id, "AllNodesScan", NoChildren, Seq(EstimatedRows(2)), Set("b")) + val rhsPD = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "AllNodesScan", NoChildren, Seq(EstimatedRows(2)), Set("b")) val rhsLP = AllNodesScan(IdName("b"), Set.empty)(2) val pos = InputPosition(0, 0, 0) - val id = new Id + val id = LogicalPlanId.DEFAULT val modeCombinations = Table( "logical plan" -> "expected plan description", @@ -78,15 +78,14 @@ class LogicalPlan2PlanDescriptionTest extends CypherFunSuite with TableDrivenPro forAll(modeCombinations) { case (logicalPlan: LogicalPlan, expectedPlanDescription: PlanDescriptionImpl) => - val idMap = LogicalPlanIdentificationBuilder(logicalPlan) - val producedPlanDescription = LogicalPlan2PlanDescription(logicalPlan, idMap, IDPPlannerName) + logicalPlan.assignIds() + val producedPlanDescription = LogicalPlan2PlanDescription(logicalPlan, IDPPlannerName) def shouldBeEqual(a: InternalPlanDescription, b: InternalPlanDescription) = { withClue("name")(a.name should equal(b.name)) withClue("arguments")(a.arguments should equal(b.arguments)) withClue("variables")(a.variables should equal(b.variables)) } - withClue("id")(producedPlanDescription.id should equal(idMap(logicalPlan))) shouldBeEqual(producedPlanDescription, expectedPlanDescription) diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilderTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilderTest.scala deleted file mode 100644 index ac434b2283fee..0000000000000 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/LogicalPlanIdentificationBuilderTest.scala +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002-2017 "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.compatibility.v3_3.runtime.planDescription - -import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.ir.v3_3.{Cardinality, CardinalityEstimation, IdName, PlannerQuery} -import org.neo4j.cypher.internal.v3_3.logical.plans.{AllNodesScan, Apply} - -class LogicalPlanIdentificationBuilderTest extends CypherFunSuite { - val solved = CardinalityEstimation.lift(PlannerQuery.empty, Cardinality(1)) - - test("plan is put into ID map") { - val A = AllNodesScan(IdName("a"), Set.empty)(solved) - - val map = LogicalPlanIdentificationBuilder(A) - map.keys.toList should equal(List(A)) - map.values.toList should equal(map.values.toList.distinct) // Ids must be unique - map.values shouldNot contain(null) - } - - test("plan and it's children are identified") { - val A = AllNodesScan(IdName("a"), Set.empty)(solved) - val B = AllNodesScan(IdName("b"), Set.empty)(solved) - val AB = Apply(A, B)(solved) - - val map = LogicalPlanIdentificationBuilder(AB) - map.keys.toSet should equal(Set(A, B, AB)) - map.values.toList should equal(map.values.toList.distinct) - map.values shouldNot contain(null) - } - - test("plan and decedents") { - val A = AllNodesScan(IdName("a"), Set.empty)(solved) - val B = AllNodesScan(IdName("b"), Set.empty)(solved) - val AB = Apply(A, B)(solved) - - val C = AllNodesScan(IdName("c"), Set.empty)(solved) - val D = AllNodesScan(IdName("d"), Set.empty)(solved) - val CD = Apply(C, D)(solved) - - val ABCD = Apply(AB, CD)(solved) - - val map = LogicalPlanIdentificationBuilder(ABCD) - map.keys.toSet should equal(Set(A, B, C, D, AB, CD, ABCD)) - map.values.toList should equal(map.values.toList.distinct) - map.values shouldNot contain(null) - } -} diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderSummaryTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderSummaryTest.scala index e85fb99db34b5..d9edaf47e3ca5 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderSummaryTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderSummaryTest.scala @@ -20,6 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments.{DbHits, Rows} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite class RenderSummaryTest extends CypherFunSuite { @@ -29,7 +30,7 @@ class RenderSummaryTest extends CypherFunSuite { Rows(42), DbHits(33)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set()) + val plan = PlanDescriptionImpl(new LogicalPlanId(0), "NAME", NoChildren, arguments, Set()) renderSummary(plan) should equal("Total database accesses: 33") } @@ -43,15 +44,15 @@ class RenderSummaryTest extends CypherFunSuite { Rows(42), DbHits(22)) - val child = PlanDescriptionImpl(new Id, "NAME1", NoChildren, arguments1, Set()) - val parent = PlanDescriptionImpl(new Id, "NAME2", SingleChild(child), arguments2, Set()) + val child = PlanDescriptionImpl(new LogicalPlanId(0), "NAME1", NoChildren, arguments1, Set()) + val parent = PlanDescriptionImpl(new LogicalPlanId(1), "NAME2", SingleChild(child), arguments2, Set()) renderSummary(parent) should equal("Total database accesses: 55") } test("execution plan without profiler stats uses question marks") { val arguments = Seq() - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set()) + val plan = PlanDescriptionImpl(new LogicalPlanId(0), "NAME", NoChildren, arguments, Set()) renderSummary(plan) should equal("Total database accesses: ?") } } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderTreeTableTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderTreeTableTest.scala index 766dd21b43126..58b702b81a60f 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderTreeTableTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/planDescription/RenderTreeTableTest.scala @@ -26,7 +26,7 @@ import org.neo4j.cypher.internal.frontend.v3_3.ast.{Equals, FunctionInvocation, import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.{CypherFunSuite, WindowsStringSafe} import org.neo4j.cypher.internal.frontend.v3_3.{DummyPosition, SemanticDirection, ast} import org.neo4j.cypher.internal.ir.v3_3.{Cardinality, CardinalityEstimation, IdName, PlannerQuery} -import org.neo4j.cypher.internal.v3_3.logical.plans.{Expand, ExpandAll, SingleRow} +import org.neo4j.cypher.internal.v3_3.logical.plans.{Expand, ExpandAll, LogicalPlanId, SingleRow} import org.scalatest.BeforeAndAfterAll class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { @@ -46,8 +46,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { private val pos = DummyPosition(0) test("node feeding from other node") { - val leaf = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", SingleChild(leaf), Seq.empty, Set()) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", SingleChild(leaf), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+----------+ @@ -61,9 +61,9 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("node feeding from two nodes") { - val leaf1 = PlanDescriptionImpl(new Id, "LEAF1", NoChildren, Seq.empty, Set()) - val leaf2 = PlanDescriptionImpl(new Id, "LEAF2", NoChildren, Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", TwoChildren(leaf1, leaf2), Seq.empty, Set()) + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF1", NoChildren, Seq.empty, Set()) + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF2", NoChildren, Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", TwoChildren(leaf1, leaf2), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+----------+ @@ -79,9 +79,9 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("node feeding of node that is feeding of node") { - val leaf = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq.empty, Set()) - val intermediate = PlanDescriptionImpl(new Id, "INTERMEDIATE", SingleChild(leaf), Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", SingleChild(intermediate), Seq.empty, Set()) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq.empty, Set()) + val intermediate = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", SingleChild(leaf), Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", SingleChild(intermediate), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+---------------+ @@ -97,11 +97,11 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("root with two leafs, one of which is deep") { - val leaf1 = PlanDescriptionImpl(new Id, "LEAF1", NoChildren, Seq.empty, Set()) - val leaf2 = PlanDescriptionImpl(new Id, "LEAF2", NoChildren, Seq.empty, Set()) - val leaf3 = PlanDescriptionImpl(new Id, "LEAF3", NoChildren, Seq.empty, Set()) - val intermediate = PlanDescriptionImpl(new Id, "INTERMEDIATE", TwoChildren(leaf1, leaf2), Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", TwoChildren(leaf3, intermediate), Seq.empty, Set()) + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF1", NoChildren, Seq.empty, Set()) + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF2", NoChildren, Seq.empty, Set()) + val leaf3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF3", NoChildren, Seq.empty, Set()) + val intermediate = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", TwoChildren(leaf1, leaf2), Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", TwoChildren(leaf3, intermediate), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+-----------------+ @@ -121,13 +121,13 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("root with two intermediate nodes coming from four leaf nodes") { - val leaf1 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("a")) - val leaf2 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("b")) - val leaf3 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("c")) - val leaf4 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("d")) - val intermediate1 = PlanDescriptionImpl(new Id, "INTERMEDIATE", TwoChildren(leaf1, leaf2), Seq.empty, Set()) - val intermediate2 = PlanDescriptionImpl(new Id, "INTERMEDIATE", TwoChildren(leaf3, leaf4), Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("a")) + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("b")) + val leaf3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("c")) + val leaf4 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("d")) + val intermediate1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", TwoChildren(leaf1, leaf2), Seq.empty, Set()) + val intermediate2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", TwoChildren(leaf3, leaf4), Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+-----------------+-----------+ @@ -151,49 +151,49 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("complex tree") { - val leaf1 = PlanDescriptionImpl(new Id, "LEAF1", NoChildren, Seq( + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF1", NoChildren, Seq( Rows(42), DbHits(33), PageCacheHits(1), PageCacheMisses(2), PageCacheHitRatio(1.0/3), EstimatedRows(1)), Set()) - val leaf2 = PlanDescriptionImpl(new Id, "LEAF2", NoChildren, Seq( + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF2", NoChildren, Seq( Rows(9), DbHits(2), PageCacheHits(2), PageCacheMisses(3), PageCacheHitRatio(2.0/5), EstimatedRows(1)), Set()) - val leaf3 = PlanDescriptionImpl(new Id, "LEAF3", NoChildren, Seq( + val leaf3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF3", NoChildren, Seq( Rows(9), DbHits(2), PageCacheHits(3), PageCacheMisses(4), PageCacheHitRatio(3.0/7), EstimatedRows(1)), Set()) - val pass = PlanDescriptionImpl(new Id, "PASS", SingleChild(leaf2), Seq( + val pass = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "PASS", SingleChild(leaf2), Seq( Rows(4), DbHits(0), PageCacheHits(4), PageCacheMisses(1), PageCacheHitRatio(4.0/5), EstimatedRows(4)), Set()) - val inner = PlanDescriptionImpl(new Id, "INNER", TwoChildren(leaf1, pass), Seq( + val inner = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INNER", TwoChildren(leaf1, pass), Seq( Rows(7), DbHits(42), PageCacheHits(5), PageCacheMisses(2), PageCacheHitRatio(5.0/7), EstimatedRows(6)), Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", TwoChildren(leaf3, inner), Seq( + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", TwoChildren(leaf3, inner), Seq( Rows(3), DbHits(0), PageCacheHits(7), PageCacheMisses(10), PageCacheHitRatio(7.0/17), EstimatedRows(1)), Set()) - val parent = PlanDescriptionImpl(new Id, "PARENT", SingleChild(plan), Seq(), Set()) + val parent = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "PARENT", SingleChild(plan), Seq(), Set()) renderAsTreeTable(parent) should equal( """+------------+----------------+------+---------+-----------------+-------------------+----------------------+ @@ -225,7 +225,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { DbHits(33), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+ @@ -242,7 +242,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { DbHits(33), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("a", "b", "c")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("a", "b", "c")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+ @@ -259,7 +259,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { DbHits(33), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("a", "b", "c", "d", "e", "f")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("a", "b", "c", "d", "e", "f")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+------------------+ @@ -273,7 +273,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { test("execution plan without profiler stats are not shown") { val arguments = Seq(EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+-----------+ @@ -288,8 +288,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { val args1 = Seq(Rows(42), DbHits(33), EstimatedRows(1)) val args2 = Seq(Rows(2), DbHits(633), Index("Label", Seq("prop")), EstimatedRows(1)) - val plan1 = PlanDescriptionImpl(new Id, "NAME", NoChildren, args1, Set("a")) - val plan2 = PlanDescriptionImpl(new Id, "NAME", SingleChild(plan1), args2, Set("b")) + val plan1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, args1, Set("a")) + val plan2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", SingleChild(plan1), args2, Set("b")) renderAsTreeTable(plan2) should equal( """+----------+----------------+------+---------+-----------+--------------+ @@ -306,8 +306,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { val args1 = Seq(Rows(42), DbHits(33), EstimatedRows(1)) val args2 = Seq(Rows(2), DbHits(633), Index("Label", Seq("propA", "propB")), EstimatedRows(1)) - val plan1 = PlanDescriptionImpl(new Id, "NAME", NoChildren, args1, Set("a")) - val plan2 = PlanDescriptionImpl(new Id, "NAME", SingleChild(plan1), args2, Set("b")) + val plan1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, args1, Set("a")) + val plan2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", SingleChild(plan1), args2, Set("b")) renderAsTreeTable(plan2) should equal( """+----------+----------------+------+---------+-----------+---------------------+ @@ -322,7 +322,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { test("Expand contains information about its relations") { val expandPlan = Expand(singleRow, IdName("from"), SemanticDirection.INCOMING, Seq.empty, IdName("to"), IdName("rel"), ExpandAll)(solved) - val description = LogicalPlan2PlanDescription(new FakeIdMap, true) + expandPlan.assignIds() + val description = LogicalPlan2PlanDescription(true) renderAsTreeTable(description.create(expandPlan)) should equal( """+--------------+----------------+-----------+---------------------+ @@ -334,7 +335,9 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("Label scan should be just as pretty as you would expect") { - val pipe = PlanDescriptionImpl(new Id, "NodeByLabelScan", NoChildren, Seq(LabelName("Foo"), EstimatedRows(1)), Set("n")) + val pipe = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NodeByLabelScan", NoChildren, Seq(LabelName("Foo"), EstimatedRows + (1)), Set + ("n")) renderAsTreeTable(pipe) should equal( """+------------------+----------------+-----------+-------+ @@ -349,7 +352,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { val expandDescr = ExpandExpression("from", "rel", Seq.empty, "to", SemanticDirection.INCOMING, 0, None) val estimatedRows = EstimatedRows(1) val arguments = Seq(estimatedRows, expandDescr) - val planDescription = PlanDescriptionImpl(new Id, "VarLengthExpand(All)", NoChildren, arguments, Set("rel", "to")) + val planDescription = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "VarLengthExpand(All)", NoChildren, arguments, Set + ("rel", "to")) renderAsTreeTable(planDescription) should equal( """+-----------------------+----------------+-----------+-------------------------+ || Operator | Estimated Rows | Variables | Other | @@ -366,7 +370,9 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { ExpandExpression(" UNNAMED123", "R", Seq("WHOOP"), " UNNAMED24", SemanticDirection.OUTGOING, 1, Some(1)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n", " UNNAMED123", " FRESHID12", " AGGREGATION255")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n", " UNNAMED123", " " + + "FRESHID12", " " + + "AGGREGATION255")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------------------------------+------------------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -383,7 +389,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { ExpandExpression("source", "through", Seq("SOME","OTHER","THING"), "target", SemanticDirection.OUTGOING, 1, Some(1)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+-------------------------------------------------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -400,7 +406,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression(Not(Equals(Variable(" UNNAMED123")(pos), Variable(" UNNAMED321")(pos))(pos))(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+----------------------------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -418,7 +424,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression(HasLabels(Variable("x")(pos), Seq(ast.LabelName("Artist")(pos)))(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+----------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -436,7 +442,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression(FunctionInvocation(FunctionName("length")(pos), Variable("n")(pos))(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+-----------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -454,7 +460,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression(Variable(" id@23")(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set(" n@76")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set(" n@76")) val details = renderAsTreeTable(plan) details should equal( @@ -475,7 +481,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression(Variable(" id@23")(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl(new Id, "NAME", NoChildren, arguments, Set("n")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set("n")) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+-------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -486,8 +492,22 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("round estimated rows to int") { - val planDescr1 = PlanDescriptionImpl(new Id, "NodeByLabelScan", NoChildren, Seq(LabelName("Foo"), EstimatedRows(0.00123456789)), Set("n")) - val planDescr2 = PlanDescriptionImpl(new Id, "NodeByLabelScan", NoChildren, Seq(LabelName("Foo"), EstimatedRows(1.23456789)), Set("n")) + val planDescr1 = PlanDescriptionImpl( + LogicalPlanId.DEFAULT, + "NodeByLabelScan", + NoChildren, + Seq( + LabelName("Foo"), + EstimatedRows(0.00123456789)), + Set("n")) + val planDescr2 = PlanDescriptionImpl( + LogicalPlanId.DEFAULT, + "NodeByLabelScan", + NoChildren, + Seq( + LabelName("Foo"), + EstimatedRows(1.23456789)), + Set("n")) renderAsTreeTable(planDescr1) should equal( """+------------------+----------------+-----------+-------+ @@ -513,7 +533,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression( Property(Variable( "x" )(pos), PropertyKeyName("Artist")(pos))(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl( new Id, "NAME", NoChildren, arguments, Set( "n") ) + val plan = PlanDescriptionImpl( LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set( "n") ) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+----------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -530,7 +550,7 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { Expression( FunctionInvocation(FunctionName("exists")(pos), Property(Variable("x")(pos), PropertyKeyName("prop")(pos))(pos))(pos)), EstimatedRows(1)) - val plan = PlanDescriptionImpl( new Id, "NAME", NoChildren, arguments, Set( "n") ) + val plan = PlanDescriptionImpl( LogicalPlanId.DEFAULT, "NAME", NoChildren, arguments, Set( "n") ) renderAsTreeTable(plan) should equal( """+----------+----------------+------+---------+-----------+----------------+ || Operator | Estimated Rows | Rows | DB Hits | Variables | Other | @@ -541,9 +561,11 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("don't show unnamed variables in key names") { - val sr1 = PlanDescriptionImpl(new Id, "EmptyRow", NoChildren, Seq(EstimatedRows(1)), Set.empty) - val sr2 = PlanDescriptionImpl(new Id, "EmptyRow", NoChildren, Seq(EstimatedRows(1)), Set.empty) - val description = PlanDescriptionImpl(new Id, "NodeHashJoin", TwoChildren(sr1, sr2), Seq(EstimatedRows(42)), Set("a", " UNNAMED45", " FRESHID77")) + val sr1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "EmptyRow", NoChildren, Seq(EstimatedRows(1)), Set.empty) + val sr2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "EmptyRow", NoChildren, Seq(EstimatedRows(1)), Set.empty) + val description = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NodeHashJoin", TwoChildren(sr1, sr2), Seq(EstimatedRows + (42)), Set("a", + " UNNAMED45", " FRESHID77")) renderAsTreeTable(description) should equal( """+---------------+----------------+-----------------------+ @@ -575,8 +597,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { */ test("compact two identical nodes") { - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, Set()) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+----------+ @@ -588,8 +610,8 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("compact two similar nodes with variables") { - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set("a")) - val plan = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, Set("b")) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set("a")) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, Set("b")) renderAsTreeTable(plan) should equal( """+----------+-----------+ @@ -601,10 +623,10 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("compact two pairs of similar nodes with variables") { - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set("a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, Set("b")) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq.empty, Set("c")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq.empty, Set("d")) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set("a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, Set("b")) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq.empty, Set("c")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq.empty, Set("d")) renderAsTreeTable(p3) should equal( """+--------------+-----------+ @@ -618,10 +640,10 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("compact two pairs of similar nodes with same variables") { - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set("a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, Set("b")) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq.empty, Set("a")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq.empty, Set("b")) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set("a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, Set("b")) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq.empty, Set("a")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq.empty, Set("b")) renderAsTreeTable(p3) should equal( """+--------------+-----------+ @@ -635,10 +657,10 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("compact two pairs of similar nodes with one new variable") { - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set("a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, Set("b")) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq.empty, Set("a")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq.empty, Set("b", "c")) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set("a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, Set("b")) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq.empty, Set("a")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq.empty, Set("b", "c")) renderAsTreeTable(p3) should equal( """+--------------+-----------+ @@ -654,10 +676,10 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { test("compact two pairs of similar nodes with many repeating variables") { val repeating = ('b' to 'z').toSet[Char].map(c => s"var_$c") - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq.empty, Set("var_a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, repeating) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq.empty, Set("var_a")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq.empty, repeating + "var_A" + "var_B") + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq.empty, Set("var_a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, repeating) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq.empty, Set("var_a")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq.empty, repeating + "var_A" + "var_B") renderAsTreeTable(p3) should equal( """+--------------+--------------------------------------------------------------------------------------------------+ @@ -673,10 +695,10 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { test("compact only the sufficiently similar pair of two simular pairs of nodes with many repeating variables") { val repeating = ('b' to 'z').toSet[Char].map(c => s"var_$c") - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(LabelName("123")), Set("var_a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq.empty, repeating) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq.empty, repeating + "var_A" + "var_B") - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq.empty, Set("var_a")) + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(LabelName("123")), Set("var_a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq.empty, repeating) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq.empty, repeating + "var_A" + "var_B") + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq.empty, Set("var_a")) renderAsTreeTable(p3) should equal( """+--------------+--------------------------------------------------------------------------------------------------+-------+ @@ -697,10 +719,11 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { val t = Time(12345678) val r = Rows(2) val d = DbHits(2) - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(l, t, r, d), Set("var_a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq(t, r, d), repeating) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq(t, r, d), Set("var_a")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq(t, r, d), repeating + "var_A" + "var_B") + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(l, t, r, d), Set("var_a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq(t, r, d), repeating) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq(t, r, d), Set("var_a")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq(t, r, d), repeating + "var_A" + + "var_B") renderAsTreeTable(p3) should equal( """+--------------+------+---------+-----------+--------------------------------------------------------------------------------------------------+-------+ @@ -721,10 +744,11 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { val t = Time(12345678) val r = Rows(2) val d = DbHits(2) - val leaf = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(l, t, r, d), Set("var_a")) - val p1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf), Seq(l, t, r, d), repeating) - val p2 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p1), Seq(l, t, r, d), Set("var_a")) - val p3 = PlanDescriptionImpl(new Id, "OPERATOR", SingleChild(p2), Seq(l, t, r, d), repeating + "var_A" + "var_B") + val leaf = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(l, t, r, d), Set("var_a")) + val p1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf), Seq(l, t, r, d), repeating) + val p2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p1), Seq(l, t, r, d), Set("var_a")) + val p3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "OPERATOR", SingleChild(p2), Seq(l, t, r, d), repeating + "var_A" + + "var_B") renderAsTreeTable(p3) should equal( """+-----------+------+---------+-----------+------------------------------------------------------------------------------------------------+-------+ @@ -742,17 +766,19 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("no compaction on complex plan with no repeated names") { - val leaf1 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("a")) - val leaf2 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("b")) - val leaf3 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("c")) - val leaf4 = PlanDescriptionImpl(new Id, "LEAF", NoChildren, Seq(), Set("d")) - val branch1 = PlanDescriptionImpl(new Id, "BRANCH", SingleChild(leaf1), Seq.empty, Set("a")) - val branch2 = PlanDescriptionImpl(new Id, "BRANCH", SingleChild(leaf2), Seq.empty, Set("b")) - val branch3 = PlanDescriptionImpl(new Id, "BRANCH", SingleChild(leaf3), Seq.empty, Set("c")) - val branch4 = PlanDescriptionImpl(new Id, "BRANCH", SingleChild(leaf4), Seq.empty, Set("d")) - val intermediate1 = PlanDescriptionImpl(new Id, "INTERMEDIATE", TwoChildren(branch1, branch2), Seq.empty, Set()) - val intermediate2 = PlanDescriptionImpl(new Id, "INTERMEDIATE", TwoChildren(branch3, branch4), Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "ROOT", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("a")) + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("b")) + val leaf3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("c")) + val leaf4 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "LEAF", NoChildren, Seq(), Set("d")) + val branch1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "BRANCH", SingleChild(leaf1), Seq.empty, Set("a")) + val branch2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "BRANCH", SingleChild(leaf2), Seq.empty, Set("b")) + val branch3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "BRANCH", SingleChild(leaf3), Seq.empty, Set("c")) + val branch4 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "BRANCH", SingleChild(leaf4), Seq.empty, Set("d")) + val intermediate1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", TwoChildren(branch1, branch2), Seq.empty, + Set()) + val intermediate2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "INTERMEDIATE", TwoChildren(branch3, branch4), Seq.empty, + Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "ROOT", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+-----------------+-----------+ @@ -784,17 +810,17 @@ class RenderTreeTableTest extends CypherFunSuite with BeforeAndAfterAll { } test("compaction on complex plan with repeated names") { - val leaf1 = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(), Set()) - val leaf2 = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(), Set()) - val leaf3 = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(), Set()) - val leaf4 = PlanDescriptionImpl(new Id, "NODE", NoChildren, Seq(), Set()) - val branch1 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf1), Seq.empty, Set()) - val branch2 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf2), Seq.empty, Set()) - val branch3 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf3), Seq.empty, Set()) - val branch4 = PlanDescriptionImpl(new Id, "NODE", SingleChild(leaf4), Seq.empty, Set()) - val intermediate1 = PlanDescriptionImpl(new Id, "NODE", TwoChildren(branch1, branch2), Seq.empty, Set()) - val intermediate2 = PlanDescriptionImpl(new Id, "NODE", TwoChildren(branch3, branch4), Seq.empty, Set()) - val plan = PlanDescriptionImpl(new Id, "NODE", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) + val leaf1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(), Set()) + val leaf2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(), Set()) + val leaf3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(), Set()) + val leaf4 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", NoChildren, Seq(), Set()) + val branch1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf1), Seq.empty, Set()) + val branch2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf2), Seq.empty, Set()) + val branch3 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf3), Seq.empty, Set()) + val branch4 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", SingleChild(leaf4), Seq.empty, Set()) + val intermediate1 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", TwoChildren(branch1, branch2), Seq.empty, Set()) + val intermediate2 = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", TwoChildren(branch3, branch4), Seq.empty, Set()) + val plan = PlanDescriptionImpl(LogicalPlanId.DEFAULT, "NODE", TwoChildren(intermediate1, intermediate2), Seq.empty, Set()) renderAsTreeTable(plan) should equal( """+--------------+ diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/ProfilerTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/ProfilerTest.scala index dca06c319df5d..08bfd258881a9 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/ProfilerTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/profiler/ProfilerTest.scala @@ -26,6 +26,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription._ +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{EmptyKernelStatisticProvider, KernelStatisticProvider} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, QueryTransactionalContext} @@ -319,7 +320,7 @@ case class ProfilerTestPipe(source: Pipe, name: String, rows: Int, dbAccess: Int hits: Long = 0, misses: Long = 0) extends PipeWithSource(source) { - var id = new Id + var id = LogicalPlanId.DEFAULT protected def internalCreateResults(input:Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.size diff --git a/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/QueryExecutionTracer.java b/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/QueryExecutionTracer.java index ad292867e37f8..fbcbfc260a4cd 100644 --- a/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/QueryExecutionTracer.java +++ b/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/QueryExecutionTracer.java @@ -20,10 +20,11 @@ package org.neo4j.cypher.internal.v3_3.codegen; import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.QueryExecutionEvent; -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id; +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId; + public interface QueryExecutionTracer { - QueryExecutionEvent executeOperator( Id queryId ); + QueryExecutionEvent executeOperator( LogicalPlanId queryId ); QueryExecutionTracer NONE = queryId -> QueryExecutionEvent.NONE; } diff --git a/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracer.java b/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracer.java index 1224d9f5a5ca9..12ac8b0b11c8e 100644 --- a/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracer.java +++ b/enterprise/cypher/cypher/src/main/java/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracer.java @@ -23,9 +23,9 @@ import java.util.Map; import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.QueryExecutionEvent; -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id; import org.neo4j.cypher.internal.compiler.v3_3.spi.KernelStatisticProvider; import org.neo4j.cypher.internal.v3_3.codegen.QueryExecutionTracer; +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId; import org.neo4j.helpers.MathUtil; public class ProfilingTracer implements QueryExecutionTracer @@ -54,7 +54,7 @@ public interface Clock private final Clock clock; private final KernelStatisticProvider statisticProvider; - private final Map data = new HashMap<>(); + private final Map data = new HashMap<>(); public ProfilingTracer( KernelStatisticProvider statisticProvider ) { @@ -67,29 +67,29 @@ public ProfilingTracer( KernelStatisticProvider statisticProvider ) this.statisticProvider = statisticProvider; } - public ProfilingInformation get( Id query ) + public ProfilingInformation get( LogicalPlanId query ) { Data value = data.get( query ); return value == null ? ZERO : value; } - public long timeOf( Id query ) + public long timeOf( LogicalPlanId query ) { return get( query ).time(); } - public long dbHitsOf( Id query ) + public long dbHitsOf( LogicalPlanId query ) { return get( query ).dbHits(); } - public long rowsOf( Id query ) + public long rowsOf( LogicalPlanId query ) { return get( query ).rows(); } @Override - public QueryExecutionEvent executeOperator( Id queryId ) + public QueryExecutionEvent executeOperator( LogicalPlanId queryId ) { Data data = this.data.get( queryId ); if ( data == null && queryId != null ) diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/BuildEnterpriseInterpretedExecutionPlan.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/BuildEnterpriseInterpretedExecutionPlan.scala index 94400f8c6a485..d53c9f4df4d9f 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/BuildEnterpriseInterpretedExecutionPlan.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/BuildEnterpriseInterpretedExecutionPlan.scala @@ -25,7 +25,6 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.EnterpriseR import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.phases.CompilationState import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.Pipe -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, LogicalPlanIdentificationBuilder} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.SlottedPipeBuilder import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.expressions.SlottedExpressionConverters import org.neo4j.cypher.internal.compiler.v3_3.CypherCompilerConfiguration @@ -55,7 +54,6 @@ object BuildEnterpriseInterpretedExecutionPlan extends Phase[EnterpriseRuntimeCo val runtimeSuccessRateMonitor = context.monitors.newMonitor[NewRuntimeSuccessRateMonitor]() try { val (logicalPlan, pipelines) = rewritePlan(context, from.logicalPlan) - val idMap = LogicalPlanIdentificationBuilder(logicalPlan) val converters = new ExpressionConverters(SlottedExpressionConverters, CommunityExpressionConverter) val pipeBuilderFactory = EnterprisePipeBuilderFactory(pipelines) val executionPlanBuilder = new PipeExecutionPlanBuilder(context.clock, context.monitors, @@ -64,10 +62,10 @@ object BuildEnterpriseInterpretedExecutionPlan extends Phase[EnterpriseRuntimeCo val pipeBuildContext = PipeExecutionBuilderContext(context.metrics.cardinality, from.semanticTable(), from.plannerName) val pipeInfo = executionPlanBuilder - .build(from.periodicCommit, logicalPlan, idMap)(pipeBuildContext, context.planContext) + .build(from.periodicCommit, logicalPlan)(pipeBuildContext, context.planContext) val PipeInfo(pipe: Pipe, updating, periodicCommitInfo, fp, planner) = pipeInfo val columns = from.statement().returnColumns - val resultBuilderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, columns, logicalPlan, idMap) + val resultBuilderFactory = DefaultExecutionResultBuilderFactory(pipeInfo, columns, logicalPlan) val func = BuildInterpretedExecutionPlan.getExecutionPlanFunction(periodicCommitInfo, from.queryText, updating, resultBuilderFactory, context.notificationLogger, @@ -85,7 +83,6 @@ object BuildEnterpriseInterpretedExecutionPlan extends Phase[EnterpriseRuntimeCo } private def rewritePlan(context: EnterpriseRuntimeContext, beforeRewrite: LogicalPlan) = { - beforeRewrite.assignIds() val pipelines: Map[LogicalPlanId, PipelineInformation] = SlotAllocation.allocateSlots(beforeRewrite) val slottedRewriter = new SlottedRewriter(context.planContext) val logicalPlan = slottedRewriter(beforeRewrite, pipelines) @@ -115,16 +112,15 @@ object BuildEnterpriseInterpretedExecutionPlan extends Phase[EnterpriseRuntimeCo case class EnterprisePipeBuilderFactory(pipelineInformation: Map[LogicalPlanId, PipelineInformation]) extends PipeBuilderFactory { - def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, idMap: Map[LogicalPlan, Id], + def apply(monitors: Monitors, recurse: LogicalPlan => Pipe, readOnly: Boolean, expressionConverters: ExpressionConverters) (implicit context: PipeExecutionBuilderContext, planContext: PlanContext): PipeBuilder = { val expressionToExpression = recursePipes(recurse, planContext) _ - val fallback = CommunityPipeBuilder(monitors, recurse, readOnly, idMap, expressionConverters, - expressionToExpression) + val fallback = CommunityPipeBuilder(monitors, recurse, readOnly, expressionConverters, expressionToExpression) - new SlottedPipeBuilder(fallback, expressionConverters, idMap, monitors, pipelineInformation, readOnly, + new SlottedPipeBuilder(fallback, expressionConverters, monitors, pipelineInformation, readOnly, expressionToExpression) } } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenContext.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenContext.scala index 64dd0540c7290..794c33ca9df13 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenContext.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenContext.scala @@ -22,22 +22,21 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen import org.neo4j.cypher.InternalException import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.JoinData import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.expressions.CodeGenType -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.SemanticTable -import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlan +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlan, LogicalPlanId} import scala.collection.mutable case class Variable(name: String, codeGenType: CodeGenType, nullable: Boolean = false) -class CodeGenContext(val semanticTable: SemanticTable, idMap: Map[LogicalPlan, Id], +class CodeGenContext(val semanticTable: SemanticTable, lookup: Map[String, Int], val namer: Namer = Namer()) { private val variables: mutable.Map[String, Variable] = mutable.Map() private val projectedVariables: mutable.Map[String, Variable] = mutable.Map.empty private val probeTables: mutable.Map[CodeGenPlan, JoinData] = mutable.Map() private val parents: mutable.Stack[CodeGenPlan] = mutable.Stack() - val operatorIds: mutable.Map[Id, String] = mutable.Map() + val operatorIds: mutable.Map[LogicalPlanId, String] = mutable.Map() def addVariable(queryVariable: String, variable: Variable) { //assert(!variables.isDefinedAt(queryVariable)) // TODO: Make the cases where overwriting the value is ok explicit (by using updateVariable) @@ -91,7 +90,7 @@ class CodeGenContext(val semanticTable: SemanticTable, idMap: Map[LogicalPlan, I def popParent(): CodeGenPlan = parents.pop() def registerOperator(plan: LogicalPlan): String = { - operatorIds.getOrElseUpdate(idMap(plan), namer.newOpName(plan.getClass.getSimpleName)) + operatorIds.getOrElseUpdate(plan.assignedId, namer.newOpName(plan.getClass.getSimpleName)) } } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenerator.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenerator.scala index 9d481d383161c..ae5c9b053846d 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenerator.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/CodeGenerator.scala @@ -29,7 +29,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.spi import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.{CompiledExecutionResult, CompiledPlan, RunnablePlan} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{PlanFingerprint, Provider} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments.{Runtime, RuntimeImpl} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, InternalPlanDescription, LogicalPlan2PlanDescription, LogicalPlanIdentificationBuilder} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{InternalPlanDescription, LogicalPlan2PlanDescription} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{CompiledRuntimeName, ExecutionMode, TaskCloser} import org.neo4j.cypher.internal.compiler.v3_3.planner.CantCompileQueryException import org.neo4j.cypher.internal.compiler.v3_3.spi.{InstrumentedGraphStatistics, PlanContext} @@ -38,7 +38,7 @@ import org.neo4j.cypher.internal.frontend.v3_3.{PlannerName, SemanticTable} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.v3_3.codegen.QueryExecutionTracer import org.neo4j.cypher.internal.v3_3.executionplan.{GeneratedQuery, GeneratedQueryExecution} -import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlan, ProduceResult} +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlan, LogicalPlanId, ProduceResult} import org.neo4j.values.virtual.MapValue class CodeGenerator(val structure: CodeStructure[GeneratedQuery], clock: Clock, conf: CodeGenConfiguration = CodeGenConfiguration() ) { @@ -51,10 +51,8 @@ class CodeGenerator(val structure: CodeStructure[GeneratedQuery], clock: Clock, def generate(plan: LogicalPlan, planContext: PlanContext, semanticTable: SemanticTable, plannerName: PlannerName): CompiledPlan = { plan match { case res: ProduceResult => - val idMap = LogicalPlanIdentificationBuilder(plan) - val query: CodeStructureResult[GeneratedQuery] = try { - generateQuery(plan, semanticTable, idMap, res.columns, conf) + generateQuery(plan, semanticTable, res.columns, conf) } catch { case e: CantCompileQueryException => throw e case e: Exception => throw new CantCompileQueryException(cause = e) @@ -67,7 +65,7 @@ class CodeGenerator(val structure: CodeStructure[GeneratedQuery], clock: Clock, None } - val descriptionTree = LogicalPlan2PlanDescription(plan, idMap, plannerName) + val descriptionTree = LogicalPlan2PlanDescription(plan, plannerName) val description: InternalPlanDescription = query.code.foldLeft(descriptionTree) { case (descriptionRoot, code) => descriptionRoot.addArgument(code) }.addArgument(Runtime(CompiledRuntimeName.toTextOutput)) @@ -90,14 +88,14 @@ class CodeGenerator(val structure: CodeStructure[GeneratedQuery], clock: Clock, } } - private def generateQuery(plan: LogicalPlan, semantics: SemanticTable, ids: Map[LogicalPlan, Id], + private def generateQuery(plan: LogicalPlan, semantics: SemanticTable, columns: Seq[String], conf: CodeGenConfiguration): CodeStructureResult[GeneratedQuery] = { import LogicalPlanConverter._ val lookup = columns.indices.map(i => columns(i) -> i).toMap - implicit val context = new CodeGenContext(semantics, ids, lookup) + implicit val context = new CodeGenContext(semantics, lookup) val (_, instructions) = asCodeGenPlan(plan).produce(context) generateCode(structure)(instructions, context.operatorIds.map { - case (id: Id, field: String) => field -> id + case (id: LogicalPlanId, field: String) => field -> id }.toMap, columns, conf) } @@ -121,8 +119,10 @@ class CodeGenerator(val structure: CodeStructure[GeneratedQuery], clock: Clock, object CodeGenerator { type SourceSink = Option[(String, String) => Unit] - def generateCode[T](structure: CodeStructure[T])(instructions: Seq[Instruction], operatorIds: Map[String, Id], - columns: Seq[String], conf: CodeGenConfiguration)(implicit context: CodeGenContext): CodeStructureResult[T] = { + def generateCode[T](structure: CodeStructure[T])(instructions: Seq[Instruction], + operatorIds: Map[String, LogicalPlanId], + columns: Seq[String], + conf: CodeGenConfiguration)(implicit context: CodeGenContext): CodeStructureResult[T] = { structure.generateQuery(Namer.newClassName(), columns, operatorIds, conf) { accept => instructions.foreach(insn => insn.init(accept)) instructions.foreach(insn => insn.body(accept)) diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/spi/CodeStructure.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/spi/CodeStructure.scala index 3719fea47b624..0d14dd9f7385f 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/spi/CodeStructure.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/compiled/codegen/spi/CodeStructure.scala @@ -20,12 +20,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.spi import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.{CodeGenConfiguration, CodeGenContext} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId /** * This constitutes the SPI for code generation. */ trait CodeStructure[T] { - def generateQuery(className: String, columns: Seq[String], operatorIds: Map[String, Id], conf: CodeGenConfiguration) + def generateQuery(className: String, columns: Seq[String], operatorIds: Map[String, LogicalPlanId], conf: CodeGenConfiguration) (block: MethodStructure[_] => Unit)(implicit codeGenContext: CodeGenContext): CodeStructureResult[T] } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala index 352f1be065ce5..eb6a564c9c4a5 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala @@ -34,7 +34,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.convert.Dir import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.expressions.{BoolType, CodeGenType, CypherCodeGenType, FloatType, ListReferenceType, LongType, ReferenceType, RepresentationType, Parameter => _} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.spi._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.{CodeGenContext, QueryExecutionEvent} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{NodeIdWrapper, RelationshipIdWrapper} import org.neo4j.cypher.internal.frontend.v3_3.helpers._ import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CTInteger, CTNode, CTRelationship, ListType} @@ -367,7 +367,7 @@ class GeneratedMethodStructure(val fields: Fields, val generator: CodeBlock, aux private def traceEvent(planStepId: String) = invoke(tracer, executeOperator, - getStatic(FieldReference.staticField(generator.owner(), typeRef[Id], planStepId))) + getStatic(FieldReference.staticField(generator.owner(), typeRef[LogicalPlanId], planStepId))) override def incrementDbHits() = if (tracing) generator.expression(invoke(loadEvent, Methods.dbHit)) diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedQueryStructure.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedQueryStructure.scala index 6175574677435..5c6da8aa02aba 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedQueryStructure.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedQueryStructure.scala @@ -34,8 +34,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.expressions._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.spi.{CodeStructure, CodeStructureResult, MethodStructure} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{Completable, Provider} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, InternalPlanDescription} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionMode, TaskCloser} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.helpers.using import org.neo4j.cypher.internal.frontend.v3_3.symbols import org.neo4j.cypher.internal.javacompat.ResultRecord @@ -96,7 +97,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { override def generateQuery(className: String, columns: Seq[String], - operatorIds: Map[String, Id], + operatorIds: Map[String, LogicalPlanId], conf: CodeGenConfiguration) (methodStructure: MethodStructure[_] => Unit) (implicit codeGenContext: CodeGenContext): GeneratedQueryStructureResult = { @@ -141,7 +142,9 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { val clazz: Class[_] = execution.loadClass() operatorIds.foreach { - case (key, id) => setStaticField(clazz, key, id) + case (key, id) => + val anyRefId = id.asInstanceOf[AnyRef] + setStaticField(clazz, key, anyRefId) } GeneratedQueryStructureResult(query, sourceSaver.sourceCode, sourceSaver.bytecode) } @@ -183,9 +186,9 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { clazz.generate(Templates.FIELD_NAMES) } - private def setOperatorIds(clazz: ClassGenerator, operatorIds: Map[String, Id]) = { + private def setOperatorIds(clazz: ClassGenerator, operatorIds: Map[String, LogicalPlanId]) = { operatorIds.keys.foreach { opId => - clazz.staticField(typeRef[Id], opId) + clazz.staticField(typeRef[LogicalPlanId], opId) } } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/Methods.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/Methods.scala index 18a7b70a45014..6c3fbc276e91a 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/Methods.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/Methods.scala @@ -25,7 +25,7 @@ import org.neo4j.collection.primitive.{PrimitiveLongIntMap, PrimitiveLongIterato import org.neo4j.cypher.internal.codegen.CompiledConversionUtils.CompositeKey import org.neo4j.cypher.internal.codegen._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.QueryExecutionEvent -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{NodeIdWrapper, RelationshipIdWrapper} import org.neo4j.cypher.internal.javacompat.ResultRecord import org.neo4j.cypher.internal.v3_3.codegen.QueryExecutionTracer @@ -105,7 +105,7 @@ object Methods { val relId = method[RelationshipIdWrapper, Long]("id") val set = method[ResultRecord, Unit]("set", typeRef[Int], typeRef[AnyValue]) val visit = method[QueryResultVisitor[_], Boolean]("visit", typeRef[Record]) - val executeOperator = method[QueryExecutionTracer, QueryExecutionEvent]("executeOperator", typeRef[Id]) + val executeOperator = method[QueryExecutionTracer, QueryExecutionEvent]("executeOperator", typeRef[LogicalPlanId]) val dbHit = method[QueryExecutionEvent, Unit]("dbHit") val row = method[QueryExecutionEvent, Unit]("row") val unboxInteger = method[java.lang.Integer, Int]("intValue") diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilderTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilderTest.scala index 5c9e9a9f50121..d92762f15371c 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilderTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilderTest.scala @@ -29,7 +29,6 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.KeyT import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.TokenType.PropertyKey import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.EnterpriseRuntimeContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.LogicalPlanIdentificationBuilder import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.expressions._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.{pipes => slottedPipes} @@ -58,12 +57,11 @@ class SlottedPipeBuilderTest extends CypherFunSuite with LogicalPlanningTestSupp val pipelines: Map[LogicalPlanId, PipelineInformation] = SlotAllocation.allocateSlots(beforeRewrite) val slottedRewriter = new SlottedRewriter(context.planContext) val logicalPlan = slottedRewriter(beforeRewrite, pipelines) - val idMap = LogicalPlanIdentificationBuilder(logicalPlan) val converters = new ExpressionConverters(CommunityExpressionConverter, SlottedExpressionConverters) val executionPlanBuilder = new PipeExecutionPlanBuilder(context.clock, context.monitors, expressionConverters = converters, pipeBuilderFactory = EnterprisePipeBuilderFactory(pipelines)) val pipeBuildContext = PipeExecutionBuilderContext(context.metrics.cardinality, table, IDPPlannerName) - executionPlanBuilder.build(None, logicalPlan, idMap)(pipeBuildContext, context.planContext).pipe + executionPlanBuilder.build(None, logicalPlan)(pipeBuildContext, context.planContext).pipe } private val x = IdName("x") diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/spi/v3_3/GeneratedMethodStructureTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/spi/v3_3/GeneratedMethodStructureTest.scala index 39a47bf46bd18..a8285c4873f70 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/spi/v3_3/GeneratedMethodStructureTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/spi/v3_3/GeneratedMethodStructureTest.scala @@ -224,7 +224,7 @@ class GeneratedMethodStructureTest extends CypherFunSuite { private def codeGenerator[E](block: GeneratedMethodStructure => Unit, mode: CodeGenerationStrategy[_]) = { val codeGen = CodeGenerator.generateCode(classOf[CodeStructure[_]].getClassLoader, mode) val packageName = "foo" - implicit val context = new CodeGenContext(SemanticTable(), Map.empty, Map.empty) + implicit val context = new CodeGenContext(SemanticTable(), Map.empty) val clazz = using(codeGen.generateClass(packageName, "Test")) { body => val fields = Fields( closer = body.field(typeRef[TaskCloser], "closer"), diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/BuildCompiledExecutionPlanTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/BuildCompiledExecutionPlanTest.scala index 643482a3bf395..5b8100e366808 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/BuildCompiledExecutionPlanTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/BuildCompiledExecutionPlanTest.scala @@ -63,6 +63,7 @@ class BuildCompiledExecutionPlanTest extends CypherFunSuite { } private def process(monitors: WrappedMonitors, plan: LogicalPlan) = { + plan.assignIds() val context = codegen.CompiledRuntimeContextHelper.create( monitors = monitors, planContext = new NotImplementedPlanContext { diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala index 0593df6cc7196..a10d721a8f196 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala @@ -1536,6 +1536,7 @@ abstract class CodeGeneratorTest extends CypherFunSuite with LogicalPlanningTest private def param(values: (String,AnyRef)*): MapValue = ValueUtils.asMapValue(values.toMap.asJava) private def compile(plan: LogicalPlan) = { + plan.assignIds() generator.generate(plan, newMockedPlanContext, semanticTable, CostBasedPlannerName.default) } diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/BuildProbeTableInstructionsTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/BuildProbeTableInstructionsTest.scala index e98091e32d86c..99b6a4e47c4c7 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/BuildProbeTableInstructionsTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/BuildProbeTableInstructionsTest.scala @@ -31,6 +31,7 @@ import org.neo4j.collection.primitive.PrimitiveLongIterator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.expressions.{CodeGenType, NodeProjection} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.{CodeGenContext, JoinTableMethod, Variable} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticTable import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, TransactionalContextWrapper} @@ -57,7 +58,7 @@ class BuildProbeTableInstructionsTest extends CypherFunSuite with CodeGenSugar { private val allNodeIds = mutable.ArrayBuffer[Long]() // used by instructions that generate probe tables - private implicit val codeGenContext = new CodeGenContext(SemanticTable(), Map.empty, Map.empty) + private implicit val codeGenContext = new CodeGenContext(SemanticTable(), Map.empty) when(queryContext.transactionalContext).thenReturn(transactionalContext) when(transactionalContext.readOperations).thenReturn(readOps) when(queryContext.entityAccessor).thenReturn(entityAccessor.asInstanceOf[queryContext.EntityAccessor]) @@ -204,7 +205,7 @@ class BuildProbeTableInstructionsTest extends CypherFunSuite with CodeGenSugar { private def runTest(buildInstruction: BuildProbeTable, nodes: Set[Variable]): List[Map[String, Object]] = { val instructions = buildProbeTableWithTwoAllNodeScans(buildInstruction, nodes) - val ids = instructions.flatMap(_.allOperatorIds.map(id => id -> null)).toMap + val ids: Map[String, LogicalPlanId] = instructions.flatMap(_.allOperatorIds.map(id => id -> LogicalPlanId.DEFAULT)).toMap evaluate(instructions, queryContext, Seq(resultRowKey), EMPTY_MAP, ids) } diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala index b448e4c236dac..494f117cc6a32 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala @@ -28,7 +28,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.codegen.ir.Instruction import org.neo4j.cypher.internal.compatibility.v3_3.runtime.compiled.{CompiledExecutionResult, CompiledPlan} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.Provider -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.{Id, InternalPlanDescription} +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionMode, NormalMode, TaskCloser} import org.neo4j.cypher.internal.compiler.v3_3.CostBasedPlannerName import org.neo4j.cypher.internal.compiler.v3_3.spi._ @@ -38,7 +38,7 @@ import org.neo4j.cypher.internal.spi.v3_3.codegen.GeneratedQueryStructure import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, TransactionBoundQueryContext, TransactionalContextWrapper} import org.neo4j.cypher.internal.v3_3.codegen.QueryExecutionTracer import org.neo4j.cypher.internal.v3_3.executionplan.{GeneratedQuery, GeneratedQueryExecution} -import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlan +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlan, LogicalPlanId} import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.kernel.GraphDatabaseQueryService @@ -97,7 +97,7 @@ trait CodeGenSugar extends MockitoSugar { qtx: QueryContext = mockQueryContext(), columns: Seq[String] = Seq.empty, params: MapValue = EMPTY_MAP, - operatorIds: Map[String, Id] = Map.empty): List[Map[String, Object]] = { + operatorIds: Map[String, LogicalPlanId] = Map.empty): List[Map[String, Object]] = { val clazz = compile(instructions, columns, operatorIds) val result = newInstance(clazz, queryContext = qtx, params = params) evaluate(result) @@ -118,11 +118,11 @@ trait CodeGenSugar extends MockitoSugar { def codeGenConfiguration = CodeGenConfiguration(mode = ByteCodeMode) def compile(instructions: Seq[Instruction], columns: Seq[String], - operatorIds: Map[String, Id] = Map.empty): GeneratedQuery = { + operatorIds: Map[String, LogicalPlanId] = Map.empty): GeneratedQuery = { //In reality the same namer should be used for construction Instruction as in generating code //these tests separate the concerns so we give this namer non-standard prefixes CodeGenerator.generateCode(GeneratedQueryStructure)(instructions, operatorIds, columns, codeGenConfiguration)( - new CodeGenContext(new SemanticTable(), Map.empty, columns.indices.map(i => columns(i) -> i).toMap, new Namer( + new CodeGenContext(new SemanticTable(), columns.indices.map(i => columns(i) -> i).toMap, new Namer( new AtomicInteger(0), varPrefix = "TEST_VAR", methodPrefix = "TEST_METHOD"))).query } @@ -139,8 +139,8 @@ trait CodeGenSugar extends MockitoSugar { new CompiledExecutionResult(taskCloser, queryContext, generated, provider) } - def insertStatic(clazz: Class[GeneratedQueryExecution], mappings: (String, Id)*) = mappings.foreach { - case (name, id) => setStaticField(clazz, name, id) + def insertStatic(clazz: Class[GeneratedQueryExecution], mappings: (String, LogicalPlanId)*) = mappings.foreach { + case (name, id) => setStaticField(clazz, name, id.asInstanceOf[AnyRef]) } private def mockQueryContext() = { diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CompiledProfilingTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CompiledProfilingTest.scala index 576fc747798ad..26cf0ea605ea7 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CompiledProfilingTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CompiledProfilingTest.scala @@ -35,7 +35,8 @@ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.ir.v3_3.{Cardinality, CardinalityEstimation, IdName, PlannerQuery} import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, QueryTransactionalContext, TransactionalContextWrapper} import org.neo4j.cypher.internal.v3_3.codegen.profiling.ProfilingTracer -import org.neo4j.cypher.internal.v3_3.logical.plans.{AllNodesScan, NodeHashJoin, ProduceResult, Projection} +import org.neo4j.cypher.internal.v3_3.logical.plans._ +import org.neo4j.cypher.internal.v3_3.logical.plans import org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService import org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracer import org.neo4j.kernel.api._ @@ -47,14 +48,14 @@ class CompiledProfilingTest extends CypherFunSuite with CodeGenSugar { test("should count db hits and rows") { // given - val id1 = new Id() - val id2 = new Id() + val id1 = new LogicalPlanId(0) + val id2 = new LogicalPlanId(1) val variable = Variable("name", CodeGenType.primitiveNode) val projectNode = NodeProjection(variable) val compiled = compile(Seq(WhileLoop(variable, ScanAllNodes("OP1"), AcceptVisitor("OP2", Map("n" -> projectNode)))), - Seq("n"), Map("OP1" -> id1, "OP2" -> id2, "X" -> new Id())) + Seq("n"), Map("OP1" -> id1, "OP2" -> id2, "X" -> LogicalPlanId.DEFAULT)) val readOps = mock[ReadOperations] val entityAccessor = mock[NodeManager] @@ -110,8 +111,9 @@ class CompiledProfilingTest extends CypherFunSuite with CodeGenSugar { val lhs = AllNodesScan(IdName("a"), Set.empty)(solved) val rhs = AllNodesScan(IdName("a"), Set.empty)(solved) val join = NodeHashJoin(Set(IdName("a")), lhs, rhs)(solved) - val projection = Projection(join, Map("foo" -> SignedDecimalIntegerLiteral("1")(null)))(solved) - val plan = ProduceResult(List("foo"), projection) + val projection = plans.Projection(join, Map("foo" -> SignedDecimalIntegerLiteral("1")(null)))(solved) + val plan = plans.ProduceResult(List("foo"), projection) + plan.assignIds() // when val result = compileAndExecute(plan, graphDb, mode = ProfileMode) diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracerTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracerTest.scala index f20103e9993bf..62ce500296ff5 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracerTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/v3_3/codegen/profiling/ProfilingTracerTest.scala @@ -19,7 +19,7 @@ */ package org.neo4j.cypher.internal.v3_3.codegen.profiling -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.compiler.v3_3.spi.{EmptyKernelStatisticProvider, KernelStatisticProvider} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracer @@ -38,7 +38,7 @@ class ProfilingTracerTest extends CypherFunSuite { test("shouldReportExecutionTimeOfQueryExecution") { // given val clock = new Clock - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val tracer = new ProfilingTracer(clock, EmptyKernelStatisticProvider) val event = tracer.executeOperator(operatorId) @@ -53,7 +53,7 @@ class ProfilingTracerTest extends CypherFunSuite { test("multiple uses of the same Id should aggregate spent time") { // given val clock = new Clock - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val tracer = new ProfilingTracer(clock, EmptyKernelStatisticProvider) // when @@ -71,7 +71,7 @@ class ProfilingTracerTest extends CypherFunSuite { test("shouldReportDbHitsOfQueryExecution") { // given - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val tracer = new ProfilingTracer(EmptyKernelStatisticProvider) val event = tracer.executeOperator(operatorId) @@ -88,7 +88,7 @@ class ProfilingTracerTest extends CypherFunSuite { test("shouldReportRowsOfQueryExecution") { // given - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val tracer = new ProfilingTracer(EmptyKernelStatisticProvider) val event = tracer.executeOperator(operatorId) @@ -105,9 +105,9 @@ class ProfilingTracerTest extends CypherFunSuite { } test("report page cache hits as part of profiling statistics") { - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val cursorTracer = new DefaultPageCursorTracer - var tracer = new ProfilingTracer(new DelegatingKernelStatisticProvider(cursorTracer)) + val tracer = new ProfilingTracer(new DelegatingKernelStatisticProvider(cursorTracer)) val event = tracer.executeOperator(operatorId) 1 to 100 foreach { _ => { @@ -124,9 +124,9 @@ class ProfilingTracerTest extends CypherFunSuite { } test("report page cache misses as part of profiling statistics") { - val operatorId = new Id + val operatorId = new LogicalPlanId(0) val cursorTracer = new DefaultPageCursorTracer - var tracer = new ProfilingTracer(new DelegatingKernelStatisticProvider(cursorTracer)) + val tracer = new ProfilingTracer(new DelegatingKernelStatisticProvider(cursorTracer)) val event = tracer.executeOperator(operatorId) 1 to 17 foreach { _ => { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilder.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilder.scala index e0bf49b4d7659..38a724f929f14 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilder.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/SlottedPipeBuilder.scala @@ -24,8 +24,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Predicate, True} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.{expressions => commandExpressions} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.builders.prepare.KeyTokenResolver -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{ColumnOrder => _, _} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.{expressions => slottedExpressions} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{LongSlot, PipeBuilder, PipeExecutionBuilderContext, PipelineInformation, _} @@ -41,7 +40,6 @@ import org.neo4j.cypher.internal.v3_3.logical.plans._ class SlottedPipeBuilder(fallback: PipeBuilder, expressionConverters: ExpressionConverters, - idMap: Map[LogicalPlan, Id], monitors: Monitors, pipelines: Map[LogicalPlanId, PipelineInformation], readOnly: Boolean, @@ -55,7 +53,7 @@ class SlottedPipeBuilder(fallback: PipeBuilder, override def build(plan: LogicalPlan): Pipe = { implicit val table: SemanticTable = context.semanticTable - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId val pipelineInformation = pipelines(plan.assignedId) plan match { @@ -93,7 +91,7 @@ class SlottedPipeBuilder(fallback: PipeBuilder, override def build(plan: LogicalPlan, source: Pipe): Pipe = { implicit val table: SemanticTable = context.semanticTable - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId val pipeline = pipelines(plan.assignedId) plan match { @@ -308,7 +306,7 @@ class SlottedPipeBuilder(fallback: PipeBuilder, override def build(plan: LogicalPlan, lhs: Pipe, rhs: Pipe): Pipe = { implicit val table: SemanticTable = context.semanticTable - val id = idMap.getOrElse(plan, new Id) + val id = plan.assignedId val pipeline = pipelines(plan.assignedId) plan match { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/AllNodesScanSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/AllNodesScanSlottedPipe.scala index ae36be03caed1..c9ca016db32c1 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/AllNodesScanSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/AllNodesScanSlottedPipe.scala @@ -21,12 +21,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class AllNodesScanSlottedPipe(ident: String, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val offset = pipelineInformation.getLongOffsetFor(ident) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ApplySlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ApplySlottedPipe.scala index d0770a656c721..d04e520409fe8 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ApplySlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ApplySlottedPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class ApplySlottedPipe(lhs: Pipe, rhs: Pipe) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(lhs) with Pipe { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = input.flatMap { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ArgumentSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ArgumentSlottedPipe.scala index 388bdecfc1498..7c501822b0a3e 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ArgumentSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ArgumentSlottedPipe.scala @@ -20,12 +20,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class ArgumentSlottedPipe(pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { override protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/BaseRelationshipSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/BaseRelationshipSlottedPipe.scala index f5126baba793a..c50cba4627477 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/BaseRelationshipSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/BaseRelationshipSlottedPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.makeValueNeoSafe import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyType, Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InvalidSemanticsException} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} @@ -96,7 +96,7 @@ abstract class BaseRelationshipSlottedPipe(src: Pipe, RelationshipKey: String, s case class CreateRelationshipSlottedPipe(src: Pipe, RelationshipKey: String, startNode: Int, typ: LazyType, endNode: Int, pipelineInformation: PipelineInformation, properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseRelationshipSlottedPipe(src, RelationshipKey, startNode, typ: LazyType, endNode, pipelineInformation, properties) { override protected def handleNull(key: String) { //do nothing @@ -106,7 +106,7 @@ case class CreateRelationshipSlottedPipe(src: Pipe, RelationshipKey: String, sta case class MergeCreateRelationshipSlottedPipe(src: Pipe, RelationshipKey: String, startNode: Int, typ: LazyType, endNode: Int, pipelineInformation: PipelineInformation, properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseRelationshipSlottedPipe(src, RelationshipKey, startNode, typ: LazyType, endNode, pipelineInformation, properties) { override protected def handleNull(key: String) { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CartesianProductSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CartesianProductSlottedPipe.scala index 0f62cec3195a3..3700004f0de63 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CartesianProductSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CartesianProductSlottedPipe.scala @@ -20,14 +20,14 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class CartesianProductSlottedPipe(lhs: Pipe, rhs: Pipe, lhsLongCount: Int, lhsRefCount: Int, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { lhs.createResults(state) flatMap { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ConditionalApplySlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ConditionalApplySlottedPipe.scala index 12b939ae678a0..0de6278ea3a07 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ConditionalApplySlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ConditionalApplySlottedPipe.scala @@ -20,15 +20,15 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.helpers.NullChecker import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.Values case class ConditionalApplySlottedPipe(lhs: Pipe, rhs: Pipe, longOffsets: Seq[Int], refOffsets: Seq[Int], negated: Boolean, pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(lhs) with Pipe { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CreateNodeSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CreateNodeSlottedPipe.scala index 4b945e006738e..209d193f94a4d 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CreateNodeSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/CreateNodeSlottedPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.makeValueNeoSafe import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyLabel, Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InvalidSemanticsException} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} @@ -85,7 +85,7 @@ abstract class BaseCreateNodeSlottedPipe(source: Pipe, ident: String, pipelineIn case class CreateNodeSlottedPipe(source: Pipe, ident: String, pipelineInformation: PipelineInformation, labels: Seq[LazyLabel], properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseCreateNodeSlottedPipe(source, ident, pipelineInformation, labels, properties) { override protected def handleNull(key: String) { @@ -95,7 +95,7 @@ case class CreateNodeSlottedPipe(source: Pipe, ident: String, pipelineInformatio case class MergeCreateNodeSlottedPipe(source: Pipe, ident: String, pipelineInformation: PipelineInformation, labels: Seq[LazyLabel], properties: Option[Expression]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends BaseCreateNodeSlottedPipe(source, ident, pipelineInformation, labels, properties) { override protected def handleNull(key: String) { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/DistinctSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/DistinctSlottedPipe.scala index ec593a20440c9..11ef281c3541e 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/DistinctSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/DistinctSlottedPipe.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.virtual.VirtualValues @@ -31,7 +31,7 @@ import scala.collection.mutable case class DistinctSlottedPipe(source: Pipe, pipelineInformation: PipelineInformation, - groupingExpressions: Map[Int, Expression])(val id: Id = new Id) + groupingExpressions: Map[Int, Expression])(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { private val keyOffsets: Array[Int] = groupingExpressions.keys.toArray diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationSlottedPipe.scala index be37a80e03558..af8404831ba7f 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationSlottedPipe.scala @@ -23,8 +23,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{AggregationExpression, Expression} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.aggregation.AggregationFunction import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import org.neo4j.values.virtual.{ListValue, MapValue, VirtualValues} @@ -37,7 +37,7 @@ import scala.collection.mutable.{Map => MutableMap} case class EagerAggregationSlottedPipe(source: Pipe, pipelineInformation: PipelineInformation, groupingExpressions: Map[Int, Expression], - aggregations: Map[Int, AggregationExpression])(val id: Id = new Id) + aggregations: Map[Int, AggregationExpression])(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { aggregations.values.foreach(_.registerOwningPipe(this)) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationWithoutGroupingSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationWithoutGroupingSlottedPipe.scala index ab5228235a617..ffecddc87b8a5 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationWithoutGroupingSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerAggregationWithoutGroupingSlottedPipe.scala @@ -22,16 +22,16 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.AggregationExpression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.aggregation.AggregationFunction import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId /* This pipe can be used whenever we are aggregating and not grouping on anything */ case class EagerAggregationWithoutGroupingSlottedPipe(source: Pipe, pipelineInformation: PipelineInformation, - aggregations: Map[Int, AggregationExpression])(val id: Id = new Id) + aggregations: Map[Int, AggregationExpression])(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { aggregations.values.foreach(_.registerOwningPipe(this)) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerSlottedPipe.scala index 68f6221d242aa..5d613964dbbdd 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/EagerSlottedPipe.scala @@ -20,11 +20,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class EagerSlottedPipe(source: Pipe, pipelineInformation: PipelineInformation)(val id: Id = new Id) +case class EagerSlottedPipe(source: Pipe, pipelineInformation: PipelineInformation)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandAllSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandAllSlottedPipe.scala index 1a426964063c1..6ca81a1c77b49 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandAllSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandAllSlottedPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.helpers.NullChecker.nodeIsNull import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator @@ -36,7 +36,7 @@ case class ExpandAllSlottedPipe(source: Pipe, dir: SemanticDirection, types: LazyTypes, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends PipeWithSource(source) with Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.flatMap { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandIntoSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandIntoSlottedPipe.scala index f66f331e3fa52..7ad712d67031b 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandIntoSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ExpandIntoSlottedPipe.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.collection.primitive.PrimitiveLongIterator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.helpers.NullChecker.nodeIsNull import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection /** @@ -44,7 +44,7 @@ case class ExpandIntoSlottedPipe(source: Pipe, dir: SemanticDirection, lazyTypes: LazyTypes, pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with PrimitiveCachingExpandInto { self => private final val CACHE_SIZE = 100000 diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexScanSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexScanSlottedPipe.scala index 4b75021ce77ff..b68e86b8f9ef6 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexScanSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexScanSlottedPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} import org.neo4j.cypher.internal.compiler.v3_3.IndexDescriptor +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} @@ -32,7 +32,7 @@ case class NodeIndexScanSlottedPipe(ident: String, label: LabelToken, propertyKey: PropertyKeyToken, pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val offset = pipelineInformation.getLongOffsetFor(ident) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexSeekSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexSeekSlottedPipe.scala index e3f29c1b054c8..5105d52173b26 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexSeekSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodeIndexSeekSlottedPipe.scala @@ -22,12 +22,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.indexQuery import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} import org.neo4j.cypher.internal.compiler.v3_3.IndexDescriptor import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.cypher.internal.v3_3.logical.plans.QueryExpression +import org.neo4j.cypher.internal.v3_3.logical.plans.{LogicalPlanId, QueryExpression} case class NodeIndexSeekSlottedPipe(ident: String, label: LabelToken, @@ -35,7 +34,7 @@ case class NodeIndexSeekSlottedPipe(ident: String, valueExpr: QueryExpression[Expression], indexMode: IndexSeekMode = IndexSeek, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val offset = pipelineInformation.getLongOffsetFor(ident) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodesByLabelScanSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodesByLabelScanSlottedPipe.scala index 3fc27ac6c2a02..8a614e137ceb7 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodesByLabelScanSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/NodesByLabelScanSlottedPipe.scala @@ -21,12 +21,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyLabel, Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class NodesByLabelScanSlottedPipe(ident: String, label: LazyLabel, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { private val offset = pipelineInformation.getLongOffsetFor(ident) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandAllSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandAllSlottedPipe.scala index 40b0893aab6eb..dfae11a300418 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandAllSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandAllSlottedPipe.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.helpers.NullChecker.nodeIsNull import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator @@ -38,7 +38,7 @@ case class OptionalExpandAllSlottedPipe(source: Pipe, types: LazyTypes, predicate: Predicate, pipelineInformation: PipelineInformation) - (val id: Id = new Id) extends PipeWithSource(source) with Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { input.flatMap { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandIntoSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandIntoSlottedPipe.scala index 7a7a66ec79ae9..4ead1cb005004 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandIntoSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalExpandIntoSlottedPipe.scala @@ -23,10 +23,10 @@ import org.neo4j.collection.primitive.PrimitiveLongIterator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.PrimitiveLongHelper import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.helpers.NullChecker.nodeIsNull import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection case class OptionalExpandIntoSlottedPipe(source: Pipe, @@ -37,7 +37,7 @@ case class OptionalExpandIntoSlottedPipe(source: Pipe, lazyTypes: LazyTypes, predicate: Predicate, pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with PrimitiveCachingExpandInto { self => private final val CACHE_SIZE = 100000 diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalSlottedPipe.scala index e8f8384e7bed1..a05a36c423f2a 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/OptionalSlottedPipe.scala @@ -20,13 +20,13 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class OptionalSlottedPipe(source: Pipe, nullableOffsets: Seq[Int], pipelineInformation: PipelineInformation) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { private def notFoundExecutionContext(state: QueryState): ExecutionContext = { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProduceResultSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProduceResultSlottedPipe.scala index 2e9e6e6bd12fa..ebcdaac6c4b90 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProduceResultSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProduceResultSlottedPipe.scala @@ -22,10 +22,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId case class ProduceResultSlottedPipe(source: Pipe, columns: Seq[(String, Expression)]) - (val id: Id = new Id) extends PipeWithSource(source) with Pipe { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with Pipe { protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = { // do not register this pipe as parent as it does not do anything except filtering of already fetched // key-value pairs and thus should not have any stats diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProjectionSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProjectionSlottedPipe.scala index 1817c47956675..e86633e3fd5a0 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProjectionSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/ProjectionSlottedPipe.scala @@ -21,15 +21,15 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, LongSlot, RefSlot, Slot} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId /* Projection evaluates expressions and stores their values into new slots in the execution context. It's an additive operation - nothing is lost in the execution context, the pipe simply adds new key-value pairs. */ case class ProjectionSlottedPipe(source: Pipe, introducedExpressions: Map[Slot, Expression]) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { introducedExpressions.values.foreach(_.registerOwningPipe(this)) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SingleRowSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SingleRowSlottedPipe.scala index 0a6bf211a3adf..ac85032872fe9 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SingleRowSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SingleRowSlottedPipe.scala @@ -21,10 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.PipelineInformation import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId -case class SingleRowSlottedPipe(pipelineInformation: PipelineInformation)(val id: Id = new Id) extends Pipe { +case class SingleRowSlottedPipe(pipelineInformation: PipelineInformation)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends Pipe { def internalCreateResults(state: QueryState) = diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SortSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SortSlottedPipe.scala index cd73618d5d567..2f3da19d7e7cf 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SortSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/SortSlottedPipe.scala @@ -21,12 +21,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import java.util.Comparator -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime._ +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.{AnyValue, AnyValues} -case class SortSlottedPipe(source: Pipe, orderBy: Seq[ColumnOrder], pipelineInformation: PipelineInformation)(val id: Id = new Id) +case class SortSlottedPipe(source: Pipe, orderBy: Seq[ColumnOrder], pipelineInformation: PipelineInformation)(val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { assert(orderBy.nonEmpty) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/TopSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/TopSlottedPipe.scala index 4171ca6d0b1e3..f95969ec9a265 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/TopSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/TopSlottedPipe.scala @@ -24,8 +24,8 @@ import java.util.Comparator import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.DefaultComparatorTopTable +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.storable.NumberValue import scala.collection.JavaConverters._ @@ -43,7 +43,7 @@ abstract class TopSlottedPipe(source: Pipe, orderBy: Seq[ColumnOrder]) } case class TopNSlottedPipe(source: Pipe, orderBy: Seq[ColumnOrder], countExpression: Expression) - (val id: Id = new Id) extends TopSlottedPipe(source, orderBy) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopSlottedPipe(source, orderBy) { countExpression.registerOwningPipe(this) @@ -75,7 +75,7 @@ case class TopNSlottedPipe(source: Pipe, orderBy: Seq[ColumnOrder], countExpress * an array, instead just store a single value. */ case class Top1SlottedPipe(source: Pipe, orderBy: List[ColumnOrder]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopSlottedPipe(source, orderBy) { protected override def internalCreateResults(input: Iterator[ExecutionContext], @@ -104,7 +104,7 @@ case class Top1SlottedPipe(source: Pipe, orderBy: List[ColumnOrder]) * Special case for when we only want one element, and all others that have the same value (tied for first place) */ case class Top1WithTiesSlottedPipe(source: Pipe, orderBy: List[ColumnOrder]) - (val id: Id = new Id) + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends TopSlottedPipe(source, orderBy) { protected override def internalCreateResults(input: Iterator[ExecutionContext], diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/UnwindSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/UnwindSlottedPipe.scala index b3c6724c74523..4f5c44702b93c 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/UnwindSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/UnwindSlottedPipe.scala @@ -22,16 +22,16 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ListSupport import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.values.AnyValue import scala.annotation.tailrec import scala.collection.JavaConverters._ case class UnwindSlottedPipe(source: Pipe, collection: Expression, offset: Int, pipeline: PipelineInformation) - (val id: Id = new Id) extends PipeWithSource(source) with ListSupport { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) with ListSupport { override protected def internalCreateResults(input: Iterator[ExecutionContext], state: QueryState): Iterator[ExecutionContext] = new UnwindIterator(input, state) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala index f2ba5fd07f613..44b563230916d 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala @@ -21,9 +21,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyTypes, Pipe, PipeWithSource, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} import org.neo4j.graphdb.Relationship import org.neo4j.helpers.ValueUtils @@ -48,7 +48,7 @@ case class VarLengthExpandSlottedPipe(source: Pipe, nodePredicate: Predicate, edgePredicate: Predicate, longsToCopy: Int) - (val id: Id = new Id) extends PipeWithSource(source) { + (val id: LogicalPlanId = LogicalPlanId.DEFAULT) extends PipeWithSource(source) { type LNode = Long private def varLengthExpand(node: LNode, diff --git a/enterprise/cypher/slotted-runtime/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/FakeSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/FakeSlottedPipe.scala index 22fe46d6476f3..c82168be57291 100644 --- a/enterprise/cypher/slotted-runtime/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/FakeSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/FakeSlottedPipe.scala @@ -19,11 +19,11 @@ */ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.pipes -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, LongSlot, PipelineInformation, RefSlot} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.ValueConversion.asValue import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{Pipe, QueryState} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, LongSlot, PipelineInformation, RefSlot} +import org.neo4j.cypher.internal.v3_3.logical.plans.LogicalPlanId import org.scalatest.mock.MockitoSugar case class FakeSlottedPipe(data: Iterator[Map[String, Any]], pipeline: PipelineInformation) @@ -50,5 +50,5 @@ case class FakeSlottedPipe(data: Iterator[Map[String, Any]], pipeline: PipelineI } } - var id = new Id + var id = LogicalPlanId.DEFAULT }