-
Notifications
You must be signed in to change notification settings - Fork 64
PLAN-2443 - Include allReduce in the Pattern docs where QPPs are described #1407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| An alternative is to use the information that we want to find paths with a total distance less than `6.05`. | ||
| From the `ALL SHORTEST` query, we know that there exists a path with a total distance of `6.04`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid mentioning SHORTEST here, it muddies the water. We don't want to suggest the association of SHORTEST with allReduce().
Like in the previous example we say "This works fine where the solution is known to lie within some range of hops.", here I would say that I pick a known upper bound of 6.05 or maybe even 7 or 10 for the total distance. I wouldn't specify how I know it to be a reasonable upper bound.
| * Nodes or relationships must have properties satisfying some condition. | ||
| For example, all relationships must have the property `distance > 10`. | ||
|
|
||
| * For every iteration of the QPP, an aggregated value over the constructed path so far should satisfy a predicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * For every iteration of the QPP, an aggregated value over the constructed path so far should satisfy a predicate. | |
| * For every iteration of the quantified path pattern, an aggregated value over the constructed path so far should satisfy a predicate. |
| | *Syntax* 3+| `allReduce(accumulator = initial, stepVariable IN list \| reductionFunction, predicate)` | ||
| | *Description* 3+| Returns true if, during the stepwise evaluation of a value across the elements in a given `LIST<ANY>`, the accumulated result satisfies a specified predicate at every step. | ||
| Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], it allows for the early pruning of paths that do not satisfy the predicate. | ||
| Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern] (not within a xref:patterns/shortest-paths.adoc[shortest path pattern]), it allows for the early pruning of paths that do not satisfy the predicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make it a bit longer and as a follow-up sentence, not between prentheses.
| Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], it allows for the early pruning of paths that do not satisfy the predicate. | ||
|
|
||
| *Note*: AllReduce should not be used for a group variable within a xref:patterns/shortest-paths.adoc[shortest path pattern]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being so picky but this doesn't sound quite right, for a few reasons:
- It should refer to the function as
allReduce(), not AllReduce, see Considerations below, - We try our very best to inline
allReduce()predicates, but it isn't always possible, - You can totally use it with
SHORTESTbut the important point is that it won't be inlined.
Something along the lines of:
When allReduce() is used with a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], its predicate will be inlined where applicable. This inlining allows for early pruning of the search space by discarding paths as soon as the predicate is not satisfied. Note that allReduce() predicates are not inlined when used in a xref:patterns/shortest-paths.adoc[shortest path pattern], and therefore do not benefit from this pruning.
| | *Syntax* 3+| `allReduce(accumulator = initial, stepVariable IN list \| reductionFunction, predicate)` | ||
| | *Description* 3+| Returns true if, during the stepwise evaluation of a value across the elements in a given `LIST<ANY>`, the accumulated result satisfies a specified predicate at every step. | ||
| Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], it allows for the early pruning of paths that do not satisfy the predicate. | ||
| When that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], its predicate will be inlined where applicable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| When that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], its predicate will be inlined where applicable. | |
| If that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], its predicate is inlined where applicable. |
| * Nodes or relationships must have properties satisfying some condition. | ||
| For example, all relationships must have the property `distance > 10`. | ||
|
|
||
| * For every iteration of the quantified path pattern, an aggregated value over the constructed path so far should satisfy a predicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * For every iteration of the quantified path pattern, an aggregated value over the constructed path so far should satisfy a predicate. | |
| * For every iteration of the quantified path pattern, an aggregated value over the constructed path so far must satisfy a predicate. |
double-check if this reflects the intended meaning
| Using inline predicates or making quantified path patterns more specific where possible can thus greatly improve query performance. | ||
|
|
||
| An alternative is to use an upper bound for the total distance, for example `6.05`. | ||
| Once a path exceeds this upper bound, we can prune it and continue searching other paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Once a path exceeds this upper bound, we can prune it and continue searching other paths. | |
| Once a path exceeds this upper bound, you can prune it and continue searching other paths. |
6d9be28 to
de4db08
Compare
|
Thanks for the documentation updates. The preview documentation has now been torn down - reopening this PR will republish it. |
|
is this tied to a specific release? |
No, it is just an extension of the docs such that people can know about allReduce() when reading about QPPs and to communicate the limitation w.r.t. SHORTEST. |
No description provided.