Add support for SELECT DISTINCT ...


Need to support returning distinct results.

  • is supported already by few vendors

  • is related and required by aggregate functions


Matija Polajnar
January 25, 2021, 11:12 PM

I wonder whether “(keeps only the first row of each set of duplicates)” makes sense. The order of results in the result set is not defined AFAIK, unless ordering is used, in which case all identical rows wil end up being consecutive and then it makes no difference whether the first, last or any other row is retained.

Thomas Beale
January 25, 2021, 11:44 PM

Well, you can read it the other way as well: since ordering is not defined, whatever the first instance encountered is by definition just as good as any other. So ‘first’ here just means ‘first encountered’, not ‘first in an ordered list’. That’s the way I would interpret it at least. The text could be modfied to ‘keeps only the first encountered of any set of duplicates' or similar.

Matija Polajnar
January 26, 2021, 12:09 AM

That’s a procedural statement that I see as an implementation detail. What if we gather all the data in parallel with a proprietary quantum computer (which we might or might not; I am not allowed to publicly state)? I see no additional value in this parenthesized sentence is what I’m trying to say.

Thomas Beale
January 26, 2021, 2:53 AM

Ah yes, I see what you mean. I agree - remove the parenthesis bit - the text is better without it.


Sebastian Iancu


Affects versions