Skip to content

Sorting semantics #66

@plcplc

Description

@plcplc

The spec for ordering by counting and column aggregations currently read (emphasis mine):

Type star_count_aggregate

An ordering of type star_count_aggregate orders rows by a count of rows in some related collection. If the respective counts are incomparable, the ordering should continue to the next OrderByElement.

and

Type single_count_aggregate

An ordering of type single_count_aggregate orders rows by an aggregate computed over rows in some related collection. If the respective aggregates are incomparable, the ordering should continue to the next OrderByElement.

What is the actual meaning of the highlighted phrases above, and what part of the engine/ndc/db complex is supposed to make that judgement?

How can a count be incomparable?

While the result of an arbitrary aggregation could conceivably be incomparable, it seems like a tall order to ask the ndc to make that judgement, and if the ndc just assumes comparability and passes the compiled query to the database it will likely just fail rather than be irrelevant to the resulting ordering as the spec suggests.

If it's meant to be an optional behavior I think it'd be nice to mark it more clearly as such (like how the W3C specifications typographically emphasise when the words "SHOULD", "MUST" etc. have a normative meaning, originally from https://www.ietf.org/rfc/rfc2119.txt I believe)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions