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

arrayCompact UB for nan, nan + Null #13857

Closed
den-crane opened this issue Aug 18, 2020 · 3 comments · Fixed by #13868
Closed

arrayCompact UB for nan, nan + Null #13857

den-crane opened this issue Aug 18, 2020 · 3 comments · Fixed by #13868
Assignees

Comments

@den-crane
Copy link
Contributor

in some cases nan === nan

SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) AS x

┌─x───────────────┐
│ [1,nan,nan,2,3] │
└─────────────────┘

SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, inf, inf, 3]) AS x

┌─x─────────────────────┐
│ [1,nan,nan,2,3,inf,3] │
└───────────────────────┘

SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, inf, inf, 3, NULL, NULL]) AS x

┌─x──────────────────────┐
│ [1,nan,2,3,inf,3,NULL] │ ???
└────────────────────────┘

SELECT arrayCompact([1, 1, inf, nan, NULL, nan, nan]) AS x

┌─x────────────────────┐
│ [1,inf,nan,NULL,nan] │  ???
└──────────────────────┘
@den-crane den-crane changed the title arrayCompact arrayCompact UB for nan, nan + Null Aug 18, 2020
@alexey-milovidov
Copy link
Member

I see, it is falling back to generic implementation if the type is Nullable,
and generic implementation uses the same comparison operator as for sorting, that requires total order.

@alexey-milovidov
Copy link
Member

Implementation specific behaviour for nans is generally Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 18, 2020
@alexey-milovidov
Copy link
Member

I can stratify it in the way that nans will be compared for bit equality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants