diff --git a/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel.adoc b/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel.adoc index f72898b618..7c3123ca86 100644 --- a/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel.adoc +++ b/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel.adoc @@ -2,4 +2,5 @@ `apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value` - executes fragment in parallel batches with the list segments being assigned to _ ¦label:procedure[] +¦label:deprecated[] ¦label:apoc-extended[] diff --git a/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel2.adoc b/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel2.adoc index 8083bff16f..7c70cd2283 100644 --- a/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel2.adoc +++ b/docs/asciidoc/modules/ROOT/examples/generated-documentation/apoc.cypher.mapParallel2.adoc @@ -2,4 +2,5 @@ `apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value` - executes fragment in parallel batches with the list segments being assigned to _ ¦label:procedure[] +¦label:deprecated[] ¦label:apoc-extended[] diff --git a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel.adoc b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel.adoc index 134fc90abf..1136fe75b6 100644 --- a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel.adoc +++ b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel.adoc @@ -5,7 +5,8 @@ This file is generated by DocsTest, so don't change it! = apoc.cypher.mapParallel :description: This section contains reference documentation for the apoc.cypher.mapParallel procedure. -label:procedure[] label:apoc-extended[] + +label:procedure[] label:apoc-extended[] label:deprecated[] [.emphasis] 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 |value|MAP? |=== +Note: this procedure is deprecated. +Use Cypher runtime parallel for single read-only operations: + +[source] +---- +CYPHER runtime=parallel +CALL { + MATCH (p:Post) + WITH + CASE + WHEN p.updatedAt IS NULL THEN [p.createdAt] + ELSE [p.createdAt, p.updatedAt] + END AS activityDates + UNWIND activityDates AS activityDate + RETURN activityDate + UNION ALL + MATCH (u:User) + UNWIND [u.createdAt, u.accessedAt] AS activityDate + RETURN activityDate +} +RETURN activityDate.year AS year, + activityDate.month AS month, + count(*) AS activity +ORDER BY activity DESC, year, month +LIMIT 10 +---- + +or, alternatively, for write operations use IN CONCURRENT TRANSACTIONS: + +[source] +---- +:auto +CALL { + UNWIND range(0,9) as b + MATCH (m:Movie { ranking: b }) RETURN m +} IN CONCURRENT TRANSACTIONS +WITH m.ranking as rank +MATCH (n:Movie) +SET n.ranking = 11 +RETURN n +---- + xref::cypher-execution/parallel.adoc[More documentation of apoc.cypher.mapParallel,role=more information] diff --git a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel2.adoc b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel2.adoc index f5f255e80b..1a54cff2fb 100644 --- a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel2.adoc +++ b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/apoc.cypher.mapParallel2.adoc @@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it! = apoc.cypher.mapParallel2 :description: This section contains reference documentation for the apoc.cypher.mapParallel2 procedure. -label:procedure[] label:apoc-extended[] +label:procedure[] label:apoc-extended[] label:deprecated[] [.emphasis] 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 |value|MAP? |=== +Note: this procedure is deprecated. +Use Cypher runtime parallel for single read-only operations: + +[source] +---- +CYPHER runtime=parallel +CALL { + MATCH (p:Post) + WITH + CASE + WHEN p.updatedAt IS NULL THEN [p.createdAt] + ELSE [p.createdAt, p.updatedAt] + END AS activityDates + UNWIND activityDates AS activityDate + RETURN activityDate + UNION ALL + MATCH (u:User) + UNWIND [u.createdAt, u.accessedAt] AS activityDate + RETURN activityDate +} +RETURN activityDate.year AS year, + activityDate.month AS month, + count(*) AS activity +ORDER BY activity DESC, year, month +LIMIT 10 +---- + +or, alternatively, for write operations use IN CONCURRENT TRANSACTIONS: + +[source] +---- +:auto +CALL { + UNWIND range(0,9) as b + MATCH (m:Movie { ranking: b }) RETURN m +} IN CONCURRENT TRANSACTIONS +WITH m.ranking as rank +MATCH (n:Movie) +SET n.ranking = 11 +RETURN n +---- + xref::cypher-execution/parallel.adoc[More documentation of apoc.cypher.mapParallel2,role=more information] diff --git a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/index.adoc b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/index.adoc index d804b925ce..7a70ab2566 100644 --- a/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/index.adoc +++ b/docs/asciidoc/modules/ROOT/pages/overview/apoc.cypher/index.adoc @@ -11,11 +11,11 @@ This file is generated by DocsTest, so don't change it! |xref::overview/apoc.cypher/apoc.cypher.mapParallel.adoc[apoc.cypher.mapParallel icon:book[]] apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _ -|label:procedure[] +|label:procedure[] label:deprecated[] |xref::overview/apoc.cypher/apoc.cypher.mapParallel2.adoc[apoc.cypher.mapParallel2 icon:book[]] apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _ -|label:procedure[] +|label:procedure[] label:deprecated[] |xref::overview/apoc.cypher/apoc.cypher.parallel.adoc[apoc.cypher.parallel icon:book[]] apoc.cypher.parallel(fragment, `paramMap`, `keyList`) yield value - executes fragments in parallel through a list defined in `paramMap` with a key `keyList` diff --git a/extended/src/main/java/apoc/cypher/CypherExtended.java b/extended/src/main/java/apoc/cypher/CypherExtended.java index dd424de076..572d004e0d 100644 --- a/extended/src/main/java/apoc/cypher/CypherExtended.java +++ b/extended/src/main/java/apoc/cypher/CypherExtended.java @@ -399,7 +399,8 @@ public Stream parallel(@Name("fragment") String fragme */ } - @Procedure + @Deprecated + @Procedure(deprecatedBy = "Cypher subqueries like: `CYPHER runtime=parallel CALL {...} ... ` or `CALL {...} IN CONCURRENT TRANSACTIONS ... `") @Description("apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _") public Stream mapParallel(@Name("fragment") String fragment, @Name("params") Map params, @Name("list") List data) { final String statement = withParamsAndIterator(fragment, params.keySet(), "_"); @@ -409,7 +410,8 @@ public Stream mapParallel(@Name("fragment") String fragment, @Name("p .map(MapResult::new); } - @Procedure + @Deprecated + @Procedure(deprecatedBy = "Cypher subqueries like: `CYPHER runtime=parallel CALL {...} ... ` or `CALL {...} IN CONCURRENT TRANSACTIONS ... `") @Description("apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _") public Stream mapParallel2(@Name("fragment") String fragment, @Name("params") Map params, @Name("list") List data, @Name("partitions") long partitions,@Name(value = "timeout",defaultValue = "10") long timeout) { final String statement = withParamsAndIterator(fragment, params.keySet(), "_");