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

Specify whether MAX/MIN (and COLL_MAX/COLL_MIN) with non-comparable types should data type mismatch #11

Open
alancai98 opened this issue May 23, 2023 · 1 comment

Comments

@alancai98
Copy link
Member

The PartiQL spec doesn’t mention whether MAX/MIN aggregation with different, non-comparable types will result in an error. The SQL-92 spec says “If MAX or MIN is specified, then the result is respectively the maximum or minimum value in TXA. These results are determined using the comparison rules specified in Subclause 8.2, ““.” — which seems to rely on the comparison operators which would error in strict mode and return missing in permissive mode.

Thereby the following queries should result in returning MISSING in permissive mode and error in strict mode:

SELECT MIN(a) AS result FROM <<{'a': 1}, {'a': 'non-number'}>>
SELECT MAX(a) AS result FROM <<{'a': 1}, {'a': 'non-number'}>>
COLL_MIN(<<1, 'non-number'>>)
COLL_MAX(<<1, 'non_number'>>)

This would contradict the current behavior defined in partiql-lang-kotlin.

@alancai98
Copy link
Member Author

It may be helpful to have a different aggregate or builtin function that takes in data that contains non-comparable types
rather than having a CASE WHEN ... statement or some other workaround.

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