Given the following unique constraint
CREATE CONSTRAINT ON (x:NODE) ASSERT x.id IS UNIQUE
running the following query fails with a Neo.DatabaseError.General.UnknownError:
CREATE (group:GROUP)
WITH group
MATCH (node:NODE)
WHERE node.id = null
CREATE (group)-[:IS_MANAGED_AT]->(node)
Neo4j Version: 3.4.0-enterprise
Operating System: Mac OS X using official Neo4j docker image
API: Neo4j browser / cypher shell
The same query given the same precondition (unique constraint) works on Neo4j 3.3.5-enterprise. And yes, I know that this query might look nonsensical because the WHERE node.id = null will never match but in our use case the IS_MANAGED_AT is optional and the null is in fact a parameter which might be NULL under some circumstances (in these case no relationship shall be created - same as if a given id does not match any NODE at all).
Query should work.
Query results in an error.
CREATE CONSTRAINT ON (x:NODE) ASSERT x.id IS UNIQUECREATE (group:GROUP)
WITH group
MATCH (node:NODE)
WHERE node.id = null
CREATE (group)-[:IS_MANAGED_AT]->(node)This is the debug log output:
2018-05-23 09:20:52.153+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [UnknownError]: null, reference 01158ab5-7eb6-4928-9877-5fd79ed0db96.
2018-05-23 09:20:52.153+0000 ERROR [o.n.b.v.r.ErrorReporter] Client triggered an unexpected error [UnknownError]: null, reference 01158ab5-7eb6-4928-9877-5fd79ed0db96.
java.lang.NullPointerException
at org.neo4j.kernel.api.impl.schema.ValueEncoding$6.encodeQuery(ValueEncoding.java:244)
at org.neo4j.kernel.api.impl.schema.LuceneDocumentStructure.newSeekQuery(LuceneDocumentStructure.java:110)
at org.neo4j.kernel.api.impl.schema.reader.SimpleIndexReader.toLuceneQuery(SimpleIndexReader.java:135)
at org.neo4j.kernel.api.impl.schema.reader.SimpleIndexReader.query(SimpleIndexReader.java:97)
at org.neo4j.kernel.impl.index.schema.fusion.FusionIndexReader.query(FusionIndexReader.java:91)
at org.neo4j.kernel.impl.newapi.Read.nodeIndexSeekWithFreshIndexReader(Read.java:207)
at org.neo4j.kernel.impl.newapi.Read.lockingNodeUniqueIndexSeek(Read.java:181)
at org.neo4j.cypher.internal.runtime.interpreted.TransactionBoundQueryContext.lockingUniqueIndexSeek(TransactionBoundQueryContext.scala:312)
at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext$$anonfun$lockingUniqueIndexSeek$1.apply(ExceptionTranslatingQueryContext.scala:202)
at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext$$anonfun$lockingUniqueIndexSeek$1.apply(ExceptionTranslatingQueryContext.scala:202)
at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslationSupport$class.translateException(ExceptionTranslationSupport.scala:33)
at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext.translateException(ExceptionTranslatingQueryContext.scala:41)
at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext.lockingUniqueIndexSeek(ExceptionTranslatingQueryContext.scala:202)
at org.neo4j.cypher.internal.runtime.interpreted.DelegatingQueryContext.lockingUniqueIndexSeek(DelegatingQueryContext.scala:163)
at org.neo4j.cypher.internal.runtime.interpreted.pipes.NodeIndexSeeker$$anonfun$indexSeek$2.apply(NodeIndexSeeker.scala:61)
at org.neo4j.cypher.internal.runtime.interpreted.pipes.NodeIndexSeeker$$anonfun$indexSeek$2.apply(NodeIndexSeeker.scala:61)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:35)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
at org.neo4j.cypher.internal.runtime.interpreted.pipes.NodeIndexSeeker$class.indexSeek(NodeIndexSeeker.scala:61)
at org.neo4j.cypher.internal.runtime.slotted.pipes.NodeIndexSeekSlottedPipe.indexSeek(NodeIndexSeekSlottedPipe.scala:36)
at org.neo4j.cypher.internal.runtime.slotted.pipes.NodeIndexSeekSlottedPipe.internalCreateResults(NodeIndexSeekSlottedPipe.scala:63)
at org.neo4j.cypher.internal.runtime.interpreted.pipes.Pipe$class.createResults(Pipe.scala:45)
at org.neo4j.cypher.internal.runtime.slotted.pipes.NodeIndexSeekSlottedPipe.createResults(NodeIndexSeekSlottedPipe.scala:36)
at org.neo4j.cypher.internal.runtime.slotted.pipes.ApplySlottedPipe$$anonfun$internalCreateResults$1.apply(ApplySlottedPipe.scala:36)
at org.neo4j.cypher.internal.runtime.slotted.pipes.ApplySlottedPipe$$anonfun$internalCreateResults$1.apply(ApplySlottedPipe.scala:34)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:435)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:441)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:409)
at org.neo4j.cypher.internal.runtime.interpreted.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:28)
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.BuildSlottedExecutionPlan$SlottedExecutionPlan.run(BuildSlottedExecutionPlan.scala:152)
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:446)
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:456)
at org.neo4j.bolt.v1.runtime.BoltStateMachine.run(BoltStateMachine.java:222)
at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onRun$3(BoltMessageRouter.java:93)
at org.neo4j.bolt.runtime.MetricsReportingBoltConnection.lambda$enqueue$0(MetricsReportingBoltConnection.java:69)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:193)
at org.neo4j.bolt.runtime.MetricsReportingBoltConnection.processNextBatch(MetricsReportingBoltConnection.java:87)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:143)
at org.neo4j.bolt.runtime.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:163)
at org.neo4j.bolt.runtime.ExecutorBoltScheduler.lambda$null$0(ExecutorBoltScheduler.java:145)
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)
@sgehrig Thanks for reporting this. We are already working on it :-)
Is this fix part of 3.4.1?
Just checked, yes it is!
Can confirm the fix. At least our test suites are running fine against 3.4.1-enterprise (while failing on 3.4.0-enterprise). THX!