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

Define comparability for container types #10

Open
alancai98 opened this issue May 23, 2023 · 0 comments
Open

Define comparability for container types #10

alancai98 opened this issue May 23, 2023 · 0 comments

Comments

@alancai98
Copy link
Member

alancai98 commented May 23, 2023

The spec mentions the total ordering behavior related to ORDER BY clauses. For example:

PartiQL> SELECT a FROM <<
   |   {'a': []},
   |   {'a': [1, 2, 3]},
   |   {'a': <<>>},
   |   {'a': <<1, 2, 3>>},
   |   {'a': {}},
   |   {'a': {'b': 'value within struct'}}
   | >>
   | ORDER BY a;
==='
[
  {
    'a': []
  },
  {
    'a': [
      1,
      2,
      3
    ]
  },
  {
    'a': {}
  },
  {
    'a': {
      'b': 'value within struct'
    }
  },
  {
    'a': <<>>
  },
  {
    'a': <<
      1,
      2,
      3
    >>
  }
]

The spec should clarify if container types can be compared outside of ORDER BY contexts (e.g. <, >, <=, >=, MAX, MIN, COLL_MAX, COLL_MIN).

The Kotlin implementation currently allows such comparisons but perhaps we should disallow (unless there's a good reason to allow it). There are some potential issues with allowing comparison of container types:

  1. If type system is not closed, the ordering may not be stable
  2. Exposes the natural ordering of the type system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant