Skip to content

Commit

Permalink
KernelAPI => InwardKernel
Browse files Browse the repository at this point in the history
The KernelAPI interface was described as the kernel face towards the world,
but it is not used like that. Changed name and made it implement
org.neo4j.internal.kernel.api.Kernel.
  • Loading branch information
fickludd committed Nov 17, 2017
1 parent 0722c63 commit f69e0d2
Show file tree
Hide file tree
Showing 58 changed files with 238 additions and 175 deletions.
Expand Up @@ -22,7 +22,6 @@
import org.neo4j.cypher.internal.CommunityCompatibilityFactory; import org.neo4j.cypher.internal.CommunityCompatibilityFactory;
import org.neo4j.graphdb.DependencyResolver; import org.neo4j.graphdb.DependencyResolver;
import org.neo4j.helpers.Service; import org.neo4j.helpers.Service;
import org.neo4j.kernel.api.KernelAPI;
import org.neo4j.kernel.impl.logging.LogService; import org.neo4j.kernel.impl.logging.LogService;
import org.neo4j.kernel.impl.query.QueryEngineProvider; import org.neo4j.kernel.impl.query.QueryEngineProvider;
import org.neo4j.kernel.impl.query.QueryExecutionEngine; import org.neo4j.kernel.impl.query.QueryExecutionEngine;
Expand Down Expand Up @@ -53,11 +52,10 @@ protected QueryExecutionEngine createEngine( Dependencies deps, GraphDatabaseAPI


DependencyResolver resolver = graphAPI.getDependencyResolver(); DependencyResolver resolver = graphAPI.getDependencyResolver();
LogService logService = resolver.resolveDependency( LogService.class ); LogService logService = resolver.resolveDependency( LogService.class );
KernelAPI kernelAPI = resolver.resolveDependency( KernelAPI.class );
Monitors monitors = resolver.resolveDependency( Monitors.class ); Monitors monitors = resolver.resolveDependency( Monitors.class );
LogProvider logProvider = logService.getInternalLogProvider(); LogProvider logProvider = logService.getInternalLogProvider();
CommunityCompatibilityFactory compatibilityFactory = CommunityCompatibilityFactory compatibilityFactory =
new CommunityCompatibilityFactory( queryService, kernelAPI, monitors, logProvider ); new CommunityCompatibilityFactory( queryService, monitors, logProvider );
deps.satisfyDependencies( compatibilityFactory ); deps.satisfyDependencies( compatibilityFactory );
return new ExecutionEngine( queryService, logProvider, compatibilityFactory ); return new ExecutionEngine( queryService, logProvider, compatibilityFactory );
} }
Expand Down
Expand Up @@ -29,7 +29,6 @@ import org.neo4j.cypher.internal.compiler.v3_4.CypherCompilerConfiguration
import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy} import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy}
import org.neo4j.helpers.Clock import org.neo4j.helpers.Clock
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.{Log, LogProvider} import org.neo4j.logging.{Log, LogProvider}


Expand All @@ -49,31 +48,31 @@ trait CompatibilityFactory {
def create(spec: PlannerSpec_v3_4, config: CypherCompilerConfiguration): Compatibility[_,_] def create(spec: PlannerSpec_v3_4, config: CypherCompilerConfiguration): Compatibility[_,_]
} }


class CommunityCompatibilityFactory(graph: GraphDatabaseQueryService, kernelAPI: KernelAPI, kernelMonitors: KernelMonitors, class CommunityCompatibilityFactory(graph: GraphDatabaseQueryService, kernelMonitors: KernelMonitors,
logProvider: LogProvider) extends CompatibilityFactory { logProvider: LogProvider) extends CompatibilityFactory {


private val log: Log = logProvider.getLog(getClass) private val log: Log = logProvider.getLog(getClass)


override def create(spec: PlannerSpec_v2_3, config: CypherCompilerConfiguration): v2_3.Compatibility = spec.planner match { override def create(spec: PlannerSpec_v2_3, config: CypherCompilerConfiguration): v2_3.Compatibility = spec.planner match {
case CypherPlanner.rule => case CypherPlanner.rule =>
v2_3.RuleCompatibility(graph, as2_3(config), Clock.SYSTEM_CLOCK, kernelMonitors, kernelAPI) v2_3.RuleCompatibility(graph, as2_3(config), Clock.SYSTEM_CLOCK, kernelMonitors)
case _ => case _ =>
v2_3.CostCompatibility(graph, as2_3(config), Clock.SYSTEM_CLOCK, kernelMonitors, kernelAPI, log, spec.planner, spec.runtime) v2_3.CostCompatibility(graph, as2_3(config), Clock.SYSTEM_CLOCK, kernelMonitors, log, spec.planner, spec.runtime)
} }


override def create(spec: PlannerSpec_v3_1, config: CypherCompilerConfiguration): v3_1.Compatibility = spec.planner match { override def create(spec: PlannerSpec_v3_1, config: CypherCompilerConfiguration): v3_1.Compatibility = spec.planner match {
case CypherPlanner.rule => case CypherPlanner.rule =>
v3_1.RuleCompatibility(graph, as3_1(config), CompilerEngineDelegator.CLOCK, kernelMonitors, kernelAPI) v3_1.RuleCompatibility(graph, as3_1(config), CompilerEngineDelegator.CLOCK, kernelMonitors)
case _ => case _ =>
v3_1.CostCompatibility(graph, as3_1(config), CompilerEngineDelegator.CLOCK, kernelMonitors, kernelAPI, log, spec.planner, spec.runtime, spec.updateStrategy) v3_1.CostCompatibility(graph, as3_1(config), CompilerEngineDelegator.CLOCK, kernelMonitors, log, spec.planner, spec.runtime, spec.updateStrategy)
} }


override def create(spec: PlannerSpec_v3_4, config: CypherCompilerConfiguration): Compatibility[_,_] = override def create(spec: PlannerSpec_v3_4, config: CypherCompilerConfiguration): Compatibility[_,_] =
(spec.planner, spec.runtime) match { (spec.planner, spec.runtime) match {
case (CypherPlanner.rule, _) => case (CypherPlanner.rule, _) =>
throw new InvalidArgumentException("The rule planner is no longer a valid planner option in Neo4j 3.4. If you need to use it, please compatibility mode Cypher 3.1") throw new InvalidArgumentException("The rule planner is no longer a valid planner option in Neo4j 3.4. If you need to use it, please compatibility mode Cypher 3.1")
case _ => case _ =>
CostCompatibility(config, CompilerEngineDelegator.CLOCK, kernelMonitors, kernelAPI, log, CostCompatibility(config, CompilerEngineDelegator.CLOCK, kernelMonitors, log,
spec.planner, spec.runtime, spec.updateStrategy, CommunityRuntimeBuilder, spec.planner, spec.runtime, spec.updateStrategy, CommunityRuntimeBuilder,
CommunityRuntimeContextCreator) CommunityRuntimeContextCreator)
} }
Expand Down
Expand Up @@ -30,7 +30,6 @@ import org.neo4j.graphdb.factory.GraphDatabaseSettings
import org.neo4j.graphdb.impl.notification.NotificationCode.{CREATE_UNIQUE_UNAVAILABLE_FALLBACK, RULE_PLANNER_UNAVAILABLE_FALLBACK, START_DEPRECATED, START_UNAVAILABLE_FALLBACK} import org.neo4j.graphdb.impl.notification.NotificationCode.{CREATE_UNIQUE_UNAVAILABLE_FALLBACK, RULE_PLANNER_UNAVAILABLE_FALLBACK, START_DEPRECATED, START_UNAVAILABLE_FALLBACK}
import org.neo4j.graphdb.impl.notification.NotificationDetail.Factory.message import org.neo4j.graphdb.impl.notification.NotificationDetail.Factory.message
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.configuration.Config import org.neo4j.kernel.configuration.Config
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.{Log, LogProvider} import org.neo4j.logging.{Log, LogProvider}
Expand Down Expand Up @@ -71,7 +70,6 @@ This class is responsible for managing the pre-parsing of queries and based on t
Cypher compiler to use Cypher compiler to use
*/ */
class CompilerEngineDelegator(graph: GraphDatabaseQueryService, class CompilerEngineDelegator(graph: GraphDatabaseQueryService,
kernelAPI: KernelAPI,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors,
configuredVersion: CypherVersion, configuredVersion: CypherVersion,
configuredPlanner: CypherPlanner, configuredPlanner: CypherPlanner,
Expand Down
Expand Up @@ -33,7 +33,7 @@ import org.neo4j.graphdb.config.Setting
import org.neo4j.graphdb.factory.GraphDatabaseSettings import org.neo4j.graphdb.factory.GraphDatabaseSettings
import org.neo4j.kernel.api.query.SchemaIndexUsage import org.neo4j.kernel.api.query.SchemaIndexUsage
import org.neo4j.kernel.api.security.AccessMode import org.neo4j.kernel.api.security.AccessMode
import org.neo4j.kernel.api.{KernelAPI, ReadOperations} import org.neo4j.kernel.api.ReadOperations
import org.neo4j.kernel.configuration.Config import org.neo4j.kernel.configuration.Config
import org.neo4j.kernel.impl.locking.ResourceTypes import org.neo4j.kernel.impl.locking.ResourceTypes
import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext} import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext}
Expand All @@ -57,7 +57,6 @@ class ExecutionEngine(val queryService: GraphDatabaseQueryService,
// true means we run inside REST server // true means we run inside REST server
protected val isServer = false protected val isServer = false
private val resolver = queryService.getDependencyResolver private val resolver = queryService.getDependencyResolver
private val kernel = resolver.resolveDependency(classOf[KernelAPI])
private val lastCommittedTxId = LastCommittedTxIdProvider(queryService) private val lastCommittedTxId = LastCommittedTxIdProvider(queryService)
private val kernelMonitors: KernelMonitors = resolver.resolveDependency(classOf[KernelMonitors]) private val kernelMonitors: KernelMonitors = resolver.resolveDependency(classOf[KernelMonitors])
private val compilationTracer: CompilationTracer = private val compilationTracer: CompilationTracer =
Expand Down Expand Up @@ -305,7 +304,7 @@ class ExecutionEngine(val queryService: GraphDatabaseQueryService,
} }


val compatibilityCache = new CompatibilityCache(compatibilityFactory) val compatibilityCache = new CompatibilityCache(compatibilityFactory)
new CompilerEngineDelegator(queryService, kernel, kernelMonitors, version, planner, runtime, new CompilerEngineDelegator(queryService, kernelMonitors, version, planner, runtime,
useErrorsOverWarnings, idpMaxTableSize, idpIterationDuration, errorIfShortestPathFallbackUsedAtRuntime, useErrorsOverWarnings, idpMaxTableSize, idpIterationDuration, errorIfShortestPathFallbackUsedAtRuntime,
errorIfShortestPathHasCommonNodesAtRuntime, legacyCsvQuoteEscaping, logProvider, compatibilityCache) errorIfShortestPathHasCommonNodesAtRuntime, legacyCsvQuoteEscaping, logProvider, compatibilityCache)
} }
Expand Down
Expand Up @@ -36,7 +36,6 @@ import org.neo4j.cypher.internal.runtime.interpreted.{LastCommittedTxIdProvider,
import org.neo4j.cypher.internal.spi.v2_3.{TransactionBoundGraphStatistics, TransactionBoundPlanContext, TransactionBoundQueryContext} import org.neo4j.cypher.internal.spi.v2_3.{TransactionBoundGraphStatistics, TransactionBoundPlanContext, TransactionBoundQueryContext}
import org.neo4j.graphdb.{Node, Relationship, Result} import org.neo4j.graphdb.{Node, Relationship, Result}
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo} import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo}
import org.neo4j.kernel.impl.core.NodeManager import org.neo4j.kernel.impl.core.NodeManager
import org.neo4j.kernel.impl.query.QueryExecutionMonitor import org.neo4j.kernel.impl.query.QueryExecutionMonitor
Expand All @@ -54,7 +53,6 @@ trait Compatibility {
val graph: GraphDatabaseQueryService val graph: GraphDatabaseQueryService
val queryCacheSize: Int val queryCacheSize: Int
val kernelMonitors: KernelMonitors val kernelMonitors: KernelMonitors
val kernelAPI: KernelAPI


protected val rewriterSequencer: (String) => RewriterStepSequencer = { protected val rewriterSequencer: (String) => RewriterStepSequencer = {
import org.neo4j.cypher.internal.compiler.v2_3.tracing.rewriters.RewriterStepSequencer._ import org.neo4j.cypher.internal.compiler.v2_3.tracing.rewriters.RewriterStepSequencer._
Expand Down
Expand Up @@ -24,7 +24,6 @@ import org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService
import org.neo4j.cypher.{CypherPlanner, CypherRuntime} import org.neo4j.cypher.{CypherPlanner, CypherRuntime}
import org.neo4j.helpers.Clock import org.neo4j.helpers.Clock
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.impl.core.NodeManager import org.neo4j.kernel.impl.core.NodeManager
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.Log import org.neo4j.logging.Log
Expand All @@ -33,7 +32,6 @@ case class CostCompatibility(graph: GraphDatabaseQueryService,
config: CypherCompilerConfiguration, config: CypherCompilerConfiguration,
clock: Clock, clock: Clock,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors,
kernelAPI: KernelAPI,
log: Log, log: Log,
planner: CypherPlanner, planner: CypherPlanner,
runtime: CypherRuntime) extends Compatibility { runtime: CypherRuntime) extends Compatibility {
Expand Down
Expand Up @@ -23,15 +23,13 @@ import org.neo4j.cypher.internal.compiler.v2_3.{CypherCompilerConfiguration, Cyp
import org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService import org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService
import org.neo4j.helpers.Clock import org.neo4j.helpers.Clock
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.impl.core.NodeManager import org.neo4j.kernel.impl.core.NodeManager
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}


case class RuleCompatibility(graph: GraphDatabaseQueryService, case class RuleCompatibility(graph: GraphDatabaseQueryService,
config: CypherCompilerConfiguration, config: CypherCompilerConfiguration,
clock: Clock, clock: Clock,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors) extends Compatibility {
kernelAPI: KernelAPI) extends Compatibility {
protected val compiler = { protected val compiler = {
val nodeManager = graph.getDependencyResolver.resolveDependency(classOf[NodeManager]) val nodeManager = graph.getDependencyResolver.resolveDependency(classOf[NodeManager])
val entityAccessor = new EntityAccessorWrapper(nodeManager) val entityAccessor = new EntityAccessorWrapper(nodeManager)
Expand Down
Expand Up @@ -30,14 +30,12 @@ import org.neo4j.cypher.internal.compiler.v3_1.executionplan.{ExecutionPlan => E
import org.neo4j.cypher.internal.compiler.v3_1.tracing.rewriters.RewriterStepSequencer import org.neo4j.cypher.internal.compiler.v3_1.tracing.rewriters.RewriterStepSequencer
import org.neo4j.cypher.internal.compiler.v3_1.{CompilationPhaseTracer, InfoLogger, ExplainMode => ExplainModev3_1, NormalMode => NormalModev3_1, ProfileMode => ProfileModev3_1, _} import org.neo4j.cypher.internal.compiler.v3_1.{CompilationPhaseTracer, InfoLogger, ExplainMode => ExplainModev3_1, NormalMode => NormalModev3_1, ProfileMode => ProfileModev3_1, _}
import org.neo4j.cypher.internal.javacompat.ExecutionResult import org.neo4j.cypher.internal.javacompat.ExecutionResult
import org.neo4j.cypher.internal.runtime.interpreted.LastCommittedTxIdProvider import org.neo4j.cypher.internal.runtime.interpreted.{LastCommittedTxIdProvider, TransactionalContextWrapper => TransactionalContextWrapperV3_4}
import org.neo4j.cypher.internal.spi.v3_1.TransactionBoundQueryContext.IndexSearchMonitor import org.neo4j.cypher.internal.spi.v3_1.TransactionBoundQueryContext.IndexSearchMonitor
import org.neo4j.cypher.internal.spi.v3_1.{TransactionalContextWrapper => TransactionalContextWrapperV3_1, _} import org.neo4j.cypher.internal.spi.v3_1.{TransactionalContextWrapper => TransactionalContextWrapperV3_1, _}
import org.neo4j.cypher.internal.runtime.interpreted.{TransactionalContextWrapper => TransactionalContextWrapperV3_4}
import org.neo4j.cypher.internal.{frontend, _} import org.neo4j.cypher.internal.{frontend, _}
import org.neo4j.graphdb.Result import org.neo4j.graphdb.Result
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo} import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo}
import org.neo4j.kernel.impl.query.QueryExecutionMonitor import org.neo4j.kernel.impl.query.QueryExecutionMonitor
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
Expand All @@ -53,7 +51,6 @@ trait Compatibility {
val graph: GraphDatabaseQueryService val graph: GraphDatabaseQueryService
val queryCacheSize: Int val queryCacheSize: Int
val kernelMonitors: KernelMonitors val kernelMonitors: KernelMonitors
val kernelAPI: KernelAPI


protected val rewriterSequencer: (String) => RewriterStepSequencer = { protected val rewriterSequencer: (String) => RewriterStepSequencer = {
import org.neo4j.cypher.internal.compiler.v3_1.tracing.rewriters.RewriterStepSequencer._ import org.neo4j.cypher.internal.compiler.v3_1.tracing.rewriters.RewriterStepSequencer._
Expand Down
Expand Up @@ -25,15 +25,13 @@ import org.neo4j.cypher.internal.compiler.v3_1._
import org.neo4j.cypher.internal.spi.v3_1.codegen.GeneratedQueryStructure import org.neo4j.cypher.internal.spi.v3_1.codegen.GeneratedQueryStructure
import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy} import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy}
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.Log import org.neo4j.logging.Log


case class CostCompatibility(graph: GraphDatabaseQueryService, case class CostCompatibility(graph: GraphDatabaseQueryService,
config: CypherCompilerConfiguration, config: CypherCompilerConfiguration,
clock: Clock, clock: Clock,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors,
kernelAPI: KernelAPI,
log: Log, log: Log,
planner: CypherPlanner, planner: CypherPlanner,
runtime: CypherRuntime, runtime: CypherRuntime,
Expand Down
Expand Up @@ -23,14 +23,12 @@ import java.time.Clock


import org.neo4j.cypher.internal.compiler.v3_1.{CypherCompilerConfiguration, CypherCompilerFactory} import org.neo4j.cypher.internal.compiler.v3_1.{CypherCompilerConfiguration, CypherCompilerFactory}
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}


case class RuleCompatibility(graph: GraphDatabaseQueryService, case class RuleCompatibility(graph: GraphDatabaseQueryService,
config: CypherCompilerConfiguration, config: CypherCompilerConfiguration,
clock: Clock, clock: Clock,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors) extends Compatibility {
kernelAPI: KernelAPI) extends Compatibility {
protected val compiler = { protected val compiler = {
val monitors = WrappedMonitors(kernelMonitors) val monitors = WrappedMonitors(kernelMonitors)
CypherCompilerFactory.ruleBasedCompiler(graph, config, clock, monitors, rewriterSequencer, typeConversions) CypherCompilerFactory.ruleBasedCompiler(graph, config, clock, monitors, rewriterSequencer, typeConversions)
Expand Down
Expand Up @@ -21,9 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_4


import java.time.Clock import java.time.Clock


import org.neo4j.cypher.{CypherExecutionMode, exceptionHandler}
import org.neo4j.cypher.internal._ import org.neo4j.cypher.internal._
import org.neo4j.cypher.internal.util.v3_4.InputPosition
import org.neo4j.cypher.internal.compatibility._ import org.neo4j.cypher.internal.compatibility._
import org.neo4j.cypher.internal.compatibility.v3_4.runtime._ import org.neo4j.cypher.internal.compatibility.v3_4.runtime._
import org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.procs.ProcedureCallOrSchemaCommandExecutionPlanBuilder import org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.procs.ProcedureCallOrSchemaCommandExecutionPlanBuilder
Expand All @@ -40,12 +38,13 @@ import org.neo4j.cypher.internal.frontend.v3_4.helpers.rewriting.RewriterStepSeq
import org.neo4j.cypher.internal.frontend.v3_4.phases._ import org.neo4j.cypher.internal.frontend.v3_4.phases._
import org.neo4j.cypher.internal.javacompat.ExecutionResult import org.neo4j.cypher.internal.javacompat.ExecutionResult
import org.neo4j.cypher.internal.planner.v3_4.spi.{CostBasedPlannerName, DPPlannerName, IDPPlannerName, PlanContext} import org.neo4j.cypher.internal.planner.v3_4.spi.{CostBasedPlannerName, DPPlannerName, IDPPlannerName, PlanContext}
import org.neo4j.cypher.internal.runtime.{ExplainMode, InternalExecutionResult, NormalMode, ProfileMode}
import org.neo4j.cypher.internal.runtime.interpreted.TransactionBoundQueryContext.IndexSearchMonitor import org.neo4j.cypher.internal.runtime.interpreted.TransactionBoundQueryContext.IndexSearchMonitor
import org.neo4j.cypher.internal.runtime.interpreted._ import org.neo4j.cypher.internal.runtime.interpreted._
import org.neo4j.cypher.internal.runtime.{ExplainMode, InternalExecutionResult, NormalMode, ProfileMode}
import org.neo4j.cypher.internal.util.v3_4.InputPosition
import org.neo4j.cypher.internal.v3_4.logical.plans.{ExplicitNodeIndexUsage, ExplicitRelationshipIndexUsage, SchemaIndexScanUsage, SchemaIndexSeekUsage} import org.neo4j.cypher.internal.v3_4.logical.plans.{ExplicitNodeIndexUsage, ExplicitRelationshipIndexUsage, SchemaIndexScanUsage, SchemaIndexSeekUsage}
import org.neo4j.cypher.{CypherExecutionMode, exceptionHandler}
import org.neo4j.graphdb.Result import org.neo4j.graphdb.Result
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.api.query.IndexUsage.{explicitIndexUsage, schemaIndexUsage} import org.neo4j.kernel.api.query.IndexUsage.{explicitIndexUsage, schemaIndexUsage}
import org.neo4j.kernel.api.query.PlannerInfo import org.neo4j.kernel.api.query.PlannerInfo
import org.neo4j.kernel.impl.query.QueryExecutionMonitor import org.neo4j.kernel.impl.query.QueryExecutionMonitor
Expand All @@ -59,7 +58,6 @@ import scala.util.Try
trait Compatibility[CONTEXT <: CommunityRuntimeContext, trait Compatibility[CONTEXT <: CommunityRuntimeContext,
T <: Transformer[CONTEXT, LogicalPlanState, CompilationState]] { T <: Transformer[CONTEXT, LogicalPlanState, CompilationState]] {
val kernelMonitors: KernelMonitors val kernelMonitors: KernelMonitors
val kernelAPI: KernelAPI
val clock: Clock val clock: Clock
val monitors: Monitors val monitors: Monitors
val config: CypherCompilerConfiguration val config: CypherCompilerConfiguration
Expand Down
Expand Up @@ -30,15 +30,13 @@ import org.neo4j.cypher.internal.frontend.v3_4.ast.Statement
import org.neo4j.cypher.internal.frontend.v3_4.phases.{Monitors, Transformer} import org.neo4j.cypher.internal.frontend.v3_4.phases.{Monitors, Transformer}
import org.neo4j.cypher.internal.planner.v3_4.spi.{CostBasedPlannerName, DPPlannerName, IDPPlannerName} import org.neo4j.cypher.internal.planner.v3_4.spi.{CostBasedPlannerName, DPPlannerName, IDPPlannerName}
import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy} import org.neo4j.cypher.{CypherPlanner, CypherRuntime, CypherUpdateStrategy}
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.Log import org.neo4j.logging.Log


case class CostCompatibility[CONTEXT <: CommunityRuntimeContext, case class CostCompatibility[CONTEXT <: CommunityRuntimeContext,
T <: Transformer[CONTEXT, LogicalPlanState, CompilationState]](config: CypherCompilerConfiguration, T <: Transformer[CONTEXT, LogicalPlanState, CompilationState]](config: CypherCompilerConfiguration,
clock: Clock, clock: Clock,
kernelMonitors: KernelMonitors, kernelMonitors: KernelMonitors,
kernelAPI: KernelAPI,
log: Log, log: Log,
planner: CypherPlanner, planner: CypherPlanner,
runtime: CypherRuntime, runtime: CypherRuntime,
Expand Down
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.cypher.internal.CommunityCompatibilityFactory; import org.neo4j.cypher.internal.CommunityCompatibilityFactory;
import org.neo4j.graphdb.Result; import org.neo4j.graphdb.Result;
import org.neo4j.kernel.GraphDatabaseQueryService; import org.neo4j.kernel.GraphDatabaseQueryService;
import org.neo4j.kernel.api.KernelAPI;
import org.neo4j.kernel.api.KernelTransaction; import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.security.SecurityContext; import org.neo4j.kernel.api.security.SecurityContext;
import org.neo4j.kernel.impl.coreapi.InternalTransaction; import org.neo4j.kernel.impl.coreapi.InternalTransaction;
Expand Down Expand Up @@ -58,12 +57,11 @@ public class ExecutionEngineTest
public void shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception public void shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception
{ {
GraphDatabaseQueryService graph = new GraphDatabaseCypherService( this.database.getGraphDatabaseAPI() ); GraphDatabaseQueryService graph = new GraphDatabaseCypherService( this.database.getGraphDatabaseAPI() );
KernelAPI kernelAPI = graph.getDependencyResolver().resolveDependency( KernelAPI.class );
Monitors monitors = graph.getDependencyResolver().resolveDependency( Monitors.class ); Monitors monitors = graph.getDependencyResolver().resolveDependency( Monitors.class );


NullLogProvider nullLogProvider = NullLogProvider.getInstance(); NullLogProvider nullLogProvider = NullLogProvider.getInstance();
CommunityCompatibilityFactory compatibilityFactory = CommunityCompatibilityFactory compatibilityFactory =
new CommunityCompatibilityFactory( graph, kernelAPI, monitors, nullLogProvider ); new CommunityCompatibilityFactory( graph, monitors, nullLogProvider );
ExecutionEngine executionEngine = new ExecutionEngine( graph, nullLogProvider, compatibilityFactory ); ExecutionEngine executionEngine = new ExecutionEngine( graph, nullLogProvider, compatibilityFactory );


Result result; Result result;
Expand Down
Expand Up @@ -30,7 +30,6 @@ import org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService
import org.neo4j.cypher.internal.runtime.{InternalExecutionResult, RuntimeScalaValueConverter} import org.neo4j.cypher.internal.runtime.{InternalExecutionResult, RuntimeScalaValueConverter}
import org.neo4j.graphdb.{GraphDatabaseService, Result} import org.neo4j.graphdb.{GraphDatabaseService, Result}
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelAPI
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.{LogProvider, NullLogProvider} import org.neo4j.logging.{LogProvider, NullLogProvider}


Expand Down Expand Up @@ -84,7 +83,6 @@ object ExecutionEngineHelper {


def createEngine(graphDatabaseCypherService: GraphDatabaseQueryService, logProvider: LogProvider = NullLogProvider.getInstance()): ExecutionEngine = { def createEngine(graphDatabaseCypherService: GraphDatabaseQueryService, logProvider: LogProvider = NullLogProvider.getInstance()): ExecutionEngine = {
val resolver = graphDatabaseCypherService.getDependencyResolver val resolver = graphDatabaseCypherService.getDependencyResolver
val kernel = resolver.resolveDependency(classOf[KernelAPI])
val kernelMonitors: KernelMonitors = resolver.resolveDependency(classOf[KernelMonitors]) val kernelMonitors: KernelMonitors = resolver.resolveDependency(classOf[KernelMonitors])
val compatibilityFactory = resolver.resolveDependency( classOf[CompatibilityFactory] ) val compatibilityFactory = resolver.resolveDependency( classOf[CompatibilityFactory] )


Expand Down
Expand Up @@ -53,7 +53,7 @@ class KillQueryTest extends ExecutionEngineFunSuite {
} }


val logProvider = NullLogProvider.getInstance() val logProvider = NullLogProvider.getInstance()
val compatibilityFactory = new CommunityCompatibilityFactory(graph, kernelAPI, kernelMonitors, logProvider) val compatibilityFactory = new CommunityCompatibilityFactory(graph, kernelMonitors, logProvider)
val engine = new ExecutionEngine(graph, logProvider, compatibilityFactory) val engine = new ExecutionEngine(graph, logProvider, compatibilityFactory)


val query = "MATCH (n:Label) WHERE n.x > 12 RETURN n.name" val query = "MATCH (n:Label) WHERE n.x > 12 RETURN n.name"
Expand Down
Expand Up @@ -59,7 +59,7 @@ class CypherCompilerAstCacheAcceptanceTest extends CypherFunSuite with GraphData
nonIndexedLabelWarningThreshold = 10000L nonIndexedLabelWarningThreshold = 10000L
) )
CostCompatibility(config, clock, kernelMonitors, CostCompatibility(config, clock, kernelMonitors,
kernelAPI, log, CypherPlanner.default, CypherRuntime.default, log, CypherPlanner.default, CypherRuntime.default,
CypherUpdateStrategy.default, CommunityRuntimeBuilder, CommunityRuntimeContextCreator) CypherUpdateStrategy.default, CommunityRuntimeBuilder, CommunityRuntimeContextCreator)
} }


Expand Down

0 comments on commit f69e0d2

Please sign in to comment.