Open ddaa2000 opened 8 months ago
A query like
MATCH (n)
WITH 1 AS a
RETURN a
on an empty graph will return nothing as the result of the MATCH is empty.
The OpenCypher documentation does not explain this very well, but the linear composition means that the WITH clause will receive the output of the last clause as input and apply it's usage on each row of that input (unless aggregation is involved). If it receives 0 rows then it will apply it's 1 as a
zero times and also give back 0 rows to the next clause.
I find that the Open-Cypher Specification for the WITH clause is a little unclear. Specifically, I'm not sure how the WITH clause deals with the result set of the previous clause if the WITH clause is a "WITH expr as a" (expr is not an aggregation function). Specifically, for the empty result set from the previous clause. Should "WITH 1 as a" return a line of 1, or no line, or this is an undefined behavior?
Thanks a lot!