You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cypher: an aggregate in a CALL body drops an import whose body matches nothing, and + on strings returns null #2074
Two places where our Cypher answers differ from openCypher's, both left over from #2006, and both already there before it.
An aggregate in a CALL body drops an import whose body matches nothing.MATCH (p:P) WHERE p.name = 'Carol' CALL (p) { MATCH (p)-[:knows]->(f) RETURN count(f) AS c } RETURN p.name, c gives no row for a friendless Carol, where the standalone MATCH … RETURN count(f) gives [[0]]; collect drops her [] the same way. The body's aggregate is grouped by the import (lower_call_branch in fluree-db-cypher/src/lower/stmt.rs for RETURN, and since fix(query): evaluate grouped SELECT expressions once per group #2006carry_imports for WITH), and an import with no body rows has no group. Before fix(query): evaluate grouped SELECT expressions once per group #2006 this was already true for RETURN; fix(query): evaluate grouped SELECT expressions once per group #2006's CALL fix brought WITH in a body onto the same model (before it, every outer row got the whole body's answer instead). The workaround documented in cypher.md is OPTIONAL MATCH. Fix sketch: left-join the imports with the grouped body and fill each aggregate's empty value (count 0, sum 0, collect[], the rest null), then drop the cypher.md qualifier fix(query): evaluate grouped SELECT expressions once per group #2006 added for this.
+ on strings returns null.RETURN p.name + 'x' is null, where openCypher concatenates strings (and lists) with +. So ORDER BY n + 'x' quietly sorts on nulls.
From #2006 (Follow-ups: an aggregate in a CALL body; Cypher + on strings).
Activity