Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sorted flag is incorrectly preserved through arithmetic overflow #14106

Closed
orlp opened this issue Jan 30, 2024 · 1 comment · Fixed by #20680
Closed

Sorted flag is incorrectly preserved through arithmetic overflow #14106

orlp opened this issue Jan 30, 2024 · 1 comment · Fixed by #20680
Assignees
Labels
A-arithmetic Area: arithmetic bug Something isn't working P-medium Priority: medium rust Related to Rust Polars

Comments

@orlp
Copy link
Collaborator

orlp commented Jan 30, 2024

We currently preserve sorted flags when adding a constant, this is incorrect when overflow occurs.

>>> s = pl.Series([0, 200], dtype=pl.UInt8).sort()
>>> s
shape: (2,)
Series: '' [u8]
[
        0
        200
]
>>> s + 200
shape: (2,)
Series: '' [u8]
[
        200
        144
]
>>> (s + 200).is_sorted()
True
@orlp orlp added bug Something isn't working P-medium Priority: medium labels Jan 30, 2024
@orlp orlp self-assigned this Jan 30, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Jan 30, 2024
@orlp orlp added rust Related to Rust Polars A-arithmetic Area: arithmetic labels Jan 30, 2024
@ritchie46
Copy link
Member

ritchie46 commented Jan 31, 2024

I think integer arithmetic should not maintain sorted flag. Can you fix this one?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-arithmetic Area: arithmetic bug Something isn't working P-medium Priority: medium rust Related to Rust Polars
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants