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
@@ -161,7 +155,6 @@ Using a `CALL` subquery can therefore reduce the amount of heap memory required
161
155
Variables from the outer scope must be explicitly imported into the inner scope of the `CALL` subquery, either by using a xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause] or an xref:subqueries/call-subquery.adoc#importing-with[importing `WITH` clause] (deprecated).
162
156
As the subquery is evaluated for each incoming input row, the imported variables are assigned the corresponding values from that row.
163
157
164
-
165
158
[[variable-scope-clause]]
166
159
=== The variable scope clause
167
160
@@ -279,7 +272,7 @@ RETURN count(t) AS totalTeams, totalPlayers
279
272
280
273
[NOTE]
281
274
=====
282
-
As of Neo4j 5.23, it is deprecated to use `CALL` subqueries without a variable scope clause.
275
+
`CALL` subqueries without a variable scope clause are deprecated.
283
276
284
277
.Deprecated
285
278
[source, cypher]
@@ -423,7 +416,6 @@ RETURN largeLists
423
416
424
417
====
425
418
426
-
427
419
[[optional-call]]
428
420
== Optional subquery calls
429
421
@@ -433,60 +425,60 @@ Similar to xref:clauses/optional-match.adoc[`OPTIONAL MATCH`] any empty rows pro
433
425
.Difference between using `CALL` and `OPTIONAL CALL`
434
426
====
435
427
436
-
This example, which finds the friends of each `Player` and xref:functions/aggregating.adoc#functions-count[counts] the number of friends per player, highlights the difference between using `CALL` and `OPTIONAL CALL`.
428
+
This example, which finds the team that each `Player` plays for, highlights the difference between using `CALL` and `OPTIONAL CALL`.
437
429
438
430
.Regular subquery `CALL`
439
431
[source, cypher]
440
432
----
441
433
MATCH (p:Player)
442
434
CALL (p) {
443
-
MATCH (p)-[:FRIEND_OF]->(friend:Player)
444
-
RETURN friend
435
+
MATCH (p)-[:PLAYS_FOR]->(team:Team)
436
+
RETURN team
445
437
}
446
-
RETURN p.name AS playerName, count(friend) AS numberOfFriends
@@ -496,8 +488,8 @@ Now, all `Player` nodes, regardless of whether they have any friends or not, are
496
488
[[call-execution-order]]
497
489
== Execution order of CALL subqueries
498
490
499
-
The order in which subqueries are executed is not defined.
500
-
If a query result depends on the order of execution of subqueries, an `ORDER BY` clause should precede the `CALL` clause.
491
+
The order in which rows from the outer scope are passed into subqueries is not defined.
492
+
If the results of the subquery depend on the order of these rows, use an `ORDER BY` clause before the `CALL` clause to guarantee a specific processing order for the rows.
@@ -642,39 +634,33 @@ The result of the `CALL` subquery is the combined result of evaluating the subqu
642
634
643
635
.`CALL` subquery changing returned rows of outer query
644
636
====
645
-
The following example finds the name of each `Player` and the names of their friends.
646
-
No rows are returned for the `Player` nodes without any `FRIEND_OF` relationships, the number of results of the subquery thus changed the number of results of the enclosing query.
637
+
The following example finds the name of each `Player` and the team they play for.
638
+
No rows are returned for `Player C`, since they are not connected to a `Team` with a `PLAYS_FOR` relationship.
639
+
The number of results of the subquery thus changed the number of results of the enclosing query.
* `CALL` subqueries optimize data handling and query efficiency, and can perform changes to the database.
774
760
775
-
* `CALL` subqueries enable progressive data transformation and can accumulate results across multiple row executions.
761
+
* `CALL` subqueries allow for row-by-row data transformation and enable the accumulation of results across multiple rows, facilitating complex operations that depend on intermediate or aggregated data.
776
762
777
763
* `CALL` subqueries can only refer to variables from the enclosing query if they are explicitly imported by either a variable scope clause or an importing `WITH` clause (deprecated).
778
764
@@ -782,4 +768,4 @@ Labels added: 18
782
768
783
769
* An `ORDER BY` clause can be used before `CALL` subqueries to ensure a specific order.
784
770
785
-
* `CALL` subqueries can be used in combination with `UNION` to process and aggregate different parts of a query result.
771
+
* `CALL` subqueries can be used in combination with `UNION` to process and aggregate different parts of a query result.
0 commit comments