Hi folks,
When I try to use apoc.temporal.format
inside an OPTIONAL MATCH
clause which returns no nodes, I get a Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke function 'apoc.temporal.format': Caused by: java.lang.NullPointerException
. Running the same query with MATCH
instead of OPTIONAL MATCH
works as expected; similarly, running the same query with a pattern that returns nodes works fine whether with using an OPTIONAL
match or not.
I've come across it in a much more complex query, so I thought it might be something to do with that, but I've reduced it to the example below, which is the most simple case I can show with it happening, and it's still there.
Is this a bug or am I doing something wrong? Currently running Neo4J 3.4.7, APOC 3.4.0.7.
Thanks!
neo4j> create (n:TestLabel{from:date("20190101"),to:date("20190201")});
0 rows available after 0 ms, consumed after another 0 ms
Added 1 nodes, Set 2 properties, Added 1 labels
neo4j> match (n:TestLabel) return apoc.temporal.format(n.from, "yyyyMMdd");
+------------------------------------------+
| apoc.temporal.format(n.from, "yyyyMMdd") |
+------------------------------------------+
| "20190101" |
+------------------------------------------+
1 row available after 1 ms, consumed after another 0 ms
neo4j> optional match (n:TestLabel) return apoc.temporal.format(n.from, "yyyyMMdd");
+------------------------------------------+
| apoc.temporal.format(n.from, "yyyyMMdd") |
+------------------------------------------+
| "20190101" |
+------------------------------------------+
1 row available after 0 ms, consumed after another 0 ms
neo4j> match (n:SomeOtherLabel) return apoc.temporal.format(n.from, "yyyyMMdd");
+------------------------------------------+
| apoc.temporal.format(n.from, "yyyyMMdd") |
+------------------------------------------+
+------------------------------------------+
0 rows available after 0 ms, consumed after another 0 ms
neo4j> optional match (n:SomeOtherLabel) return apoc.temporal.format(n.from, "yyyyMMdd");
Failed to invoke function `apoc.temporal.format`: Caused by: java.lang.NullPointerException