-
Notifications
You must be signed in to change notification settings - Fork 58
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
Standalone Order by, Skip/Offset, and Limit #1027
Standalone Order by, Skip/Offset, and Limit #1027
Conversation
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.
Great! I think we can discuss with Jens a little more on your questions :)
MATCH (n) | ||
ORDER BY n.name DESC | ||
SKIP 2 | ||
LIMIT 2 | ||
RETURN collect(n.name) AS names |
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.
This query isn't really using it standalone though right? Would standalone not look more like: MATCH (n) LIMIT 2 RETURN collect(n.name) AS names?
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 think there could be a better way to word it, or possibly have to examples. One with only limit "standalone" and one example of them together as in the vast majority of cases it doesn't make sense to use it by itself without at least and order by.
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.
So, one could argue that a separate page or section would be more useful to show the existence of Order by n.name SKIP 1 LIMIT 1
as a standalone clause
.Standalone use of `LIMIT` | ||
[source, cypher] | ||
---- | ||
MATCH (n) | ||
LIMIT 2 | ||
RETURN collect(n.name) AS names | ||
---- | ||
|
||
.Result | ||
[role="queryresult",options="header,footer",cols="1*<m"] | ||
|=== | ||
| names | ||
| ["Andy", "Bernard"] | ||
|Rows: 1 | ||
|=== |
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.
@JPryce-Aklundh Here I think we should clarify that the ordering is not guaranteed, so users do not believe they will get ascending ordering by default.
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.
We seem to have this disclaimer for SKIP which I believe is applicable here as well.
Neo4j does not guarantee the results generated by SKIP/OFFSET. The only clause that guarantees a specific row order is ORDER BY.
[[offset-synonym]] | ||
== `OFFSET` as a synonym to `SKIP` | ||
|
||
`OFFSET` was introduced as part of Cypher's xref:appendix/gql-conformance/index.adoc[] and can be used as a synonym to `SKIP`. |
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.
This is much better!
Great cleanup with the new images and examples! |
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.
This looks good to me :D
Thanks for the documentation updates. The preview documentation has now been torn down - reopening this PR will republish it. |
Adds documentation for standalone Order by, Skip/Offset, and Limit clause and introduction of the Offset keyword. Implementation of CIP-168
Questions:
Corresponding PR