Skip to content

Commit 2a40381

Browse files
authored
Fixes #3843: Deprecate mapParallel procedure and update docs (#4229)
1 parent e70fcd6 commit 2a40381

File tree

6 files changed

+95
-6
lines changed

6 files changed

+95
-6
lines changed

docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
`apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value` - executes fragment in parallel batches with the list segments being assigned to _
44
¦label:procedure[]
5+
¦label:deprecated[]
56
¦label:apoc-extended[]

docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel2.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
`apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value` - executes fragment in parallel batches with the list segments being assigned to _
44
¦label:procedure[]
5+
¦label:deprecated[]
56
¦label:apoc-extended[]

docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel.adoc

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ This file is generated by DocsTest, so don't change it!
55
= apoc.cypher.mapParallel
66
:description: This section contains reference documentation for the apoc.cypher.mapParallel procedure.
77

8-
label:procedure[] label:apoc-extended[]
8+
9+
label:procedure[] label:apoc-extended[] label:deprecated[]
910

1011
[.emphasis]
1112
apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _
@@ -33,5 +34,47 @@ apoc.cypher.mapParallel(fragment :: STRING?, params :: MAP?, list :: LIST? OF AN
3334
|value|MAP?
3435
|===
3536

37+
Note: this procedure is deprecated.
38+
Use Cypher runtime parallel for single read-only operations:
39+
40+
[source]
41+
----
42+
CYPHER runtime=parallel
43+
CALL {
44+
MATCH (p:Post)
45+
WITH
46+
CASE
47+
WHEN p.updatedAt IS NULL THEN [p.createdAt]
48+
ELSE [p.createdAt, p.updatedAt]
49+
END AS activityDates
50+
UNWIND activityDates AS activityDate
51+
RETURN activityDate
52+
UNION ALL
53+
MATCH (u:User)
54+
UNWIND [u.createdAt, u.accessedAt] AS activityDate
55+
RETURN activityDate
56+
}
57+
RETURN activityDate.year AS year,
58+
activityDate.month AS month,
59+
count(*) AS activity
60+
ORDER BY activity DESC, year, month
61+
LIMIT 10
62+
----
63+
64+
or, alternatively, for write operations use IN CONCURRENT TRANSACTIONS:
65+
66+
[source]
67+
----
68+
:auto
69+
CALL {
70+
UNWIND range(0,9) as b
71+
MATCH (m:Movie { ranking: b }) RETURN m
72+
} IN CONCURRENT TRANSACTIONS
73+
WITH m.ranking as rank
74+
MATCH (n:Movie)
75+
SET n.ranking = 11
76+
RETURN n
77+
----
78+
3679
xref::cypher-execution/parallel.adoc[More documentation of apoc.cypher.mapParallel,role=more information]
3780

docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel2.adoc

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it!
55
= apoc.cypher.mapParallel2
66
:description: This section contains reference documentation for the apoc.cypher.mapParallel2 procedure.
77

8-
label:procedure[] label:apoc-extended[]
8+
label:procedure[] label:apoc-extended[] label:deprecated[]
99

1010
[.emphasis]
1111
apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _
@@ -35,5 +35,47 @@ apoc.cypher.mapParallel2(fragment :: STRING?, params :: MAP?, list :: LIST? OF A
3535
|value|MAP?
3636
|===
3737

38+
Note: this procedure is deprecated.
39+
Use Cypher runtime parallel for single read-only operations:
40+
41+
[source]
42+
----
43+
CYPHER runtime=parallel
44+
CALL {
45+
MATCH (p:Post)
46+
WITH
47+
CASE
48+
WHEN p.updatedAt IS NULL THEN [p.createdAt]
49+
ELSE [p.createdAt, p.updatedAt]
50+
END AS activityDates
51+
UNWIND activityDates AS activityDate
52+
RETURN activityDate
53+
UNION ALL
54+
MATCH (u:User)
55+
UNWIND [u.createdAt, u.accessedAt] AS activityDate
56+
RETURN activityDate
57+
}
58+
RETURN activityDate.year AS year,
59+
activityDate.month AS month,
60+
count(*) AS activity
61+
ORDER BY activity DESC, year, month
62+
LIMIT 10
63+
----
64+
65+
or, alternatively, for write operations use IN CONCURRENT TRANSACTIONS:
66+
67+
[source]
68+
----
69+
:auto
70+
CALL {
71+
UNWIND range(0,9) as b
72+
MATCH (m:Movie { ranking: b }) RETURN m
73+
} IN CONCURRENT TRANSACTIONS
74+
WITH m.ranking as rank
75+
MATCH (n:Movie)
76+
SET n.ranking = 11
77+
RETURN n
78+
----
79+
3880
xref::cypher-execution/parallel.adoc[More documentation of apoc.cypher.mapParallel2,role=more information]
3981

docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ This file is generated by DocsTest, so don't change it!
1111
|xref::overview/apoc.cypher/apoc.cypher.mapParallel.adoc[apoc.cypher.mapParallel icon:book[]]
1212

1313
apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _
14-
|label:procedure[]
14+
|label:procedure[] label:deprecated[]
1515
|xref::overview/apoc.cypher/apoc.cypher.mapParallel2.adoc[apoc.cypher.mapParallel2 icon:book[]]
1616

1717
apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _
18-
|label:procedure[]
18+
|label:procedure[] label:deprecated[]
1919
|xref::overview/apoc.cypher/apoc.cypher.parallel.adoc[apoc.cypher.parallel icon:book[]]
2020

2121
apoc.cypher.parallel(fragment, `paramMap`, `keyList`) yield value - executes fragments in parallel through a list defined in `paramMap` with a key `keyList`

extended/src/main/java/apoc/cypher/CypherExtended.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ public Stream<CypherStatementMapResult> parallel(@Name("fragment") String fragme
415415
*/
416416
}
417417

418-
@Procedure
418+
@Deprecated
419+
@Procedure(deprecatedBy = "Cypher subqueries like: `CYPHER runtime=parallel CALL {...} ... ` or `CALL {...} IN CONCURRENT TRANSACTIONS ... `")
419420
@Description("apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _")
420421
public Stream<MapResult> mapParallel(@Name("fragment") String fragment, @Name("params") Map<String, Object> params, @Name("list") List<Object> data) {
421422
final String statement = withParamsAndIterator(fragment, params.keySet(), "_");
@@ -425,7 +426,8 @@ public Stream<MapResult> mapParallel(@Name("fragment") String fragment, @Name("p
425426
.map(MapResult::new);
426427
}
427428

428-
@Procedure
429+
@Deprecated
430+
@Procedure(deprecatedBy = "Cypher subqueries like: `CYPHER runtime=parallel CALL {...} ... ` or `CALL {...} IN CONCURRENT TRANSACTIONS ... `")
429431
@Description("apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _")
430432
public Stream<MapResult> mapParallel2(@Name("fragment") String fragment, @Name("params") Map<String, Object> params, @Name("list") List<Object> data, @Name("partitions") long partitions,@Name(value = "timeout",defaultValue = "10") long timeout) {
431433
final String statement = withParamsAndIterator(fragment, params.keySet(), "_");

0 commit comments

Comments
 (0)