Skip to content
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

ORDER BY spec could make more clear behavior with DESC #34

Open
alancai98 opened this issue Mar 31, 2022 · 0 comments
Open

ORDER BY spec could make more clear behavior with DESC #34

alancai98 opened this issue Mar 31, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@alancai98
Copy link
Member

The PartiQL spec section 12.2 currently only defines the order-by-less-than function (used for ASC) and does not explicitly mention the DESC behavior. This can be confusing for implementers as experienced in the Kotlin implementation of ORDER BY partiql/partiql-lang-kotlin#554. The behavior with respect to DESC comparison between different data types could be made clearer (whether it should compare different data types using the order-by-less-than function or the reverse/converse).

The SQL-92 spec (page 373) makes this distinction for DESC more clear:

a) Each <sort specification> specifies the sort direction for the corresponding sort key Ki. If DESC is not specified in the i-th <sort specification>, then the sort direction for Ki is ascending and the applicable <comp op> is the <less than operator>. Otherwise, the sort direction for Ki is descending and the applicable <comp op> is the <greater than operator>.

Similarly this distinction is made more clear in Couchbase's N1QL online reference: https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/orderby.html

@alancai98 alancai98 added the enhancement New feature or request label Mar 31, 2022
@johnedquinn johnedquinn transferred this issue from partiql/partiql-spec Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant