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

[opencypher TCK imcompatible] ORDER BY count(*) can't work. An alias must be provided. #2686

Open
whitewum opened this issue Feb 1, 2021 · 1 comment
Labels
type/feature req Type: feature request

Comments

@whitewum
Copy link
Contributor

whitewum commented Feb 1, 2021

The opencypher can accept ORDER BY count(*)
But nGQL can't.

The openCypher TCK

  Scenario: Count star should count everything in scope
    Given an empty graph
    And having executed:
      """
      CREATE (:L1), (:L2), (:L3)
      """
    When executing query:
      """
      MATCH (a)
      RETURN a, count(*)
      ORDER BY count(*) -- here
      """
    Then the result should be, in any order:
      | a     | count(*) |
      | (:L1) | 1        |
      | (:L2) | 1        |
      | (:L3) | 1        |
    And no side effects
  Scenario: Sort on aggregate function and normal property
    Given an empty graph
    And having executed:
      """
      CREATE ({division: 'Sweden'})
      CREATE ({division: 'Germany'})
      CREATE ({division: 'England'})
      CREATE ({division: 'Sweden'})
      """
    When executing query:
      """
      MATCH (n)
      RETURN n.division, count(*)
      ORDER BY count(*) DESC, n.division ASC  -- here
      """
    Then the result should be, in order:
      | n.division | count(*) |
      | 'Sweden'   | 2        |
      | 'England'  | 1        |
      | 'Germany'  | 1        |
    And no side effects

what nGQL does?

nGQL requires an alias, which is different from openCypher.

image

image

@jievince
Copy link
Contributor

jievince commented Feb 4, 2021

Currently, the use of ORDER BY is severely limited for implementation reasons.

order by a // legal
order by a.prop // illegal
order by b + 1 // illegal
@CPWstatic CPWstatic transferred this issue from vesoft-inc/nebula-graph Aug 28, 2021
@CPWstatic CPWstatic added the type/feature req Type: feature request label Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature req Type: feature request
3 participants