Skip to content

Commit 7dbbb86

Browse files
committed
clarified the additions entry
1 parent e315c41 commit 7dbbb86

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,26 @@ label:functionality[]
3737
label:updated[]
3838
[source, cypher]
3939
----
40-
MATCH (c:Customer)-[:BUYS]->(p:Product)
41-
RETURN c AS customer, p AS product
42-
43-
NEXT
44-
45-
RETURN product.name AS product,
46-
COUNT(customer) AS numberOfCustomers
40+
MATCH (p:Product) WHERE p.name <> "Coffee"
41+
CALL (p) {
42+
MATCH (p)<-[:BUYS]-(c:Customer)-[:BUYS]->(otherProduct)
43+
RETURN c, otherProduct
44+
NEXT
45+
RETURN count(DISTINCT c) AS customers, 0 AS customersAlsoBuyingCoffee
46+
UNION
47+
FILTER otherProduct.name = "Coffee"
48+
RETURN 0 as customers, count(DISTINCT c) AS customersAlsoBuyingCoffee
49+
NEXT
50+
RETURN max(customers) AS customers, max(customersAlsoBuyingCoffee) AS customersAlsoBuyingCoffee
51+
}
52+
RETURN p.name AS product,
53+
round(toFloat(customersAlsoBuyingCoffee) * 100 / customers, 1) AS percentageOfCustomersAlsoBuyingCoffee
54+
ORDER BY product
4755
----
4856

49-
| `NEXT` now correctly supports aggregations, updating queries and `DISTINCT` in the context `UNION`, `USE` and wrapped in braces.
50-
In Neo4j 2025.06 and Cypher 25, such queries yielded incorrect results while they created an error in Neo4j 2025.07 and Cypher 25.
57+
| `NEXT` now correctly supports aggregations in the context of `UNION` and `CALL`.
58+
In Neo4j 2025.06, such queries yielded incorrect results while they created an error in Neo4j 2025.07.
59+
For more information on `NEXT`, see xref:queries/composed-queries/sequential-queries.adoc[].
5160

5261
a|
5362
label:functionality[]

modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ RETURN p.name AS product,
359359
|===
360360

361361
This example computes the percentage of customers that also bought coffee for each non-coffee product.
362-
For each product `p` the subquery finds all pairs of a customer `c` of product `p` and another product `otherProduct` that customer has also bought.
362+
For each product `p` the subquery finds all pairs of a customer `c` of product `p` and another product `otherProduct` that the customer has also bought.
363363
The first `NEXT` passes these pairs as a whole into a `UNION`, so that the query can:
364364

365365
. count all customers in the first branch of the union.
@@ -368,6 +368,12 @@ The first `NEXT` passes these pairs as a whole into a `UNION`, so that the query
368368
The `UNION` produces two rows -- one from each branch.
369369
The second `NEXT` passes these two rows as a whole to a query that aggregates them into a single row, which is the result of the `CALL` subquery.
370370

371+
[NOTE]
372+
====
373+
The example above produced a different result in Neo4j 2025.06 and an error in 2025.07.
374+
Neo4j 2025.08 correctly supports aggregations in the context of `UNION` and `CALL`.
375+
====
376+
371377
[NOTE]
372378
====
373379
`NEXT` cannot be used inside a `CALL` subquery that uses the (deprecated) xref:subqueries/call-subquery.adoc#importing-with[importing `WITH`] syntax.

0 commit comments

Comments
 (0)