Janukowitsch
Janukowitsch

Reputation: 323

Neo4j Query falsely returns null

I am using Neo4j v 3.4.1 with Docker.

I run the following query via the cypher shell:

MATCH (blogA:content {entitySubType:"blog"})-[]->(t:term)<-[]-(blogB:content {entitySubType:"blog"})
WHERE blogA <> blogB 
RETURN ID(blogA), ID(blogB), count(t);

The query returns null after some hours. I can not understand or find anything that points me to a solution. When checking the debug log I get the following:

2018-09-08 09:53:54.675+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [Neo.DatabaseError.General.UnknownError]: null, reference 549a05ea-3bee-442b-baf5-fd741d37e2db.
2018-09-08 09:53:54.675+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [Neo.DatabaseError.General.UnknownError]: null, reference 549a05ea-3bee-442b-baf5-fd741d37e2db.
java.lang.NegativeArraySizeException
        at scala.collection.mutable.HashTable$class.resize(HashTable.scala:257)
        at scala.collection.mutable.HashTable$class.scala$collection$mutable$HashTable$$addEntry0(HashTable.scala:157)
        at scala.collection.mutable.HashTable$class.addEntry(HashTable.scala:148)
        at scala.collection.mutable.HashMap.addEntry(HashMap.scala:40)
        at scala.collection.mutable.HashMap.addEntry(HashMap.scala:93)
        at scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:79)
        at org.neo4j.cypher.internal.runtime.interpreted.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1.apply(EagerAggregationPipe.scala:120)
        at org.neo4j.cypher.internal.runtime.interpreted.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1.apply(EagerAggregationPipe.scala:118)
        at scala.collection.Iterator$class.foreach(Iterator.scala:891)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
        at org.neo4j.cypher.internal.runtime.interpreted.pipes.EagerAggregationPipe.internalCreateResults(EagerAggregationPipe.scala:118)
        at org.neo4j.cypher.internal.runtime.interpreted.pipes.PipeWithSource.createResults(Pipe.scala:76)
        at org.neo4j.cypher.internal.runtime.interpreted.pipes.PipeWithSource.createResults(Pipe.scala:72)
        at org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.BaseExecutionResultBuilderFactory$BaseExecutionWorkflowBuilder.createResults(DefaultExecutionResultBuilderFactory.scala:105)
        at org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.BaseExecutionResultBuilderFactory$BaseExecutionWorkflowBuilder.build(DefaultExecutionResultBuilderFactory.scala:77)
        at org.neo4j.cypher.internal.compatibility.v3_4.runtime.BuildInterpretedExecutionPlan$$anonfun$getExecutionPlanFunction$1.apply(BuildInterpretedExecutionPlan.scala:97)
        at org.neo4j.cypher.internal.compatibility.v3_4.runtime.BuildInterpretedExecutionPlan$$anonfun$getExecutionPlanFunction$1.apply(BuildInterpretedExecutionPlan.scala:80)
        at org.neo4j.cypher.internal.compatibility.v3_4.runtime.BuildInterpretedExecutionPlan$InterpretedExecutionPlan.run(BuildInterpretedExecutionPlan.scala:111)
        at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper$$anonfun$run$1.apply(LatestRuntimeVariablePlannerCompatibility.scala:128)
        at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper$$anonfun$run$1.apply(LatestRuntimeVariablePlannerCompatibility.scala:124)
        at org.neo4j.cypher.exceptionHandler$runSafely$.apply(exceptionHandler.scala:89)
        at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper.run(LatestRuntimeVariablePlannerCompatibility.scala:124)
        at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:29)
        at org.neo4j.cypher.internal.ExecutionEngine.execute(ExecutionEngine.scala:119)
        at org.neo4j.cypher.internal.javacompat.ExecutionEngine.executeQuery(ExecutionEngine.java:61)
        at org.neo4j.bolt.v1.runtime.TransactionStateMachineSPI$1.start(TransactionStateMachineSPI.java:144)
        at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State.startExecution(TransactionStateMachine.java:444)
        at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State$1.execute(TransactionStateMachine.java:259)
        at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State$1.run(TransactionStateMachine.java:240)
        at org.neo4j.bolt.v1.runtime.TransactionStateMachine.run(TransactionStateMachine.java:81)
        at org.neo4j.bolt.v1.runtime.BoltStateMachine$State$2.run(BoltStateMachine.java:457)
        at org.neo4j.bolt.v1.runtime.BoltStateMachine.run(BoltStateMachine.java:225)
        at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onRun$3(BoltMessageRouter.java:93)
        at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:195)
        at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:143)
        at org.neo4j.bolt.runtime.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:170)
        at org.neo4j.bolt.runtime.ExecutorBoltScheduler.lambda$scheduleBatchOrHandleError$2(ExecutorBoltScheduler.java:153)
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

We collectively assumed here that the entitySubType is not set for all content nodes. I validatet this assumpttion which is true. Based on this I reformulated my query using exists() predicate function like this:

MATCH (blogA:content)-[:TaggedWith]->(t:term)<-[:TaggedWith]-(blogB:content) 
WHERE ID(blogA) <> ID(blogB) AND exists(blogA.entitySubType) AND 
exists(blogB.entitySubType) AND "blog" = blogA.entitySubType AND "blog" = 
blogB.entitySubType RETURN ID(blogA), ID(blogB), count(t);

The query retunred null and ended with tex exception again after ~19.1h (3min earlier than last time)

The following query plan is given by the EXPLAIN command: Query PLan

I cannot see where exists(blogA.entitySubType) happens. Moreover, I cannot find the filter "blog" = blogA.entitySubType AND "blog" = blogB.entitySubType.

Is my query wrong or is the query plan visualization not complete?

Upvotes: 0

Views: 479

Answers (2)

Reetish Chand
Reetish Chand

Reputation: 103

The property "entitySubType" may not be set in some nodes, that is the reason when the query execution happens the nodes for which "entitySubType" is absent will not be returned. Ensure that all the nodes contain entitySubType property.

Upvotes: 1

bjornbergq
bjornbergq

Reputation: 31

It sounds like it might be a property that is null, maybe "entitySubType" is not set on all posts?

Is the error consistent or intermittent? Is the database continously updated, if yes, how?

Upvotes: 1

Related Questions