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

Decimal panics for in merge sorted #20989

Closed
2 tasks done
coastalwhite opened this issue Jan 29, 2025 · 0 comments · Fixed by #21018
Closed
2 tasks done

Decimal panics for in merge sorted #20989

coastalwhite opened this issue Jan 29, 2025 · 0 comments · Fixed by #21018
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@coastalwhite
Copy link
Collaborator

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl
from polars.testing import assert_series_equal

s = pl.Series('a', ["1.0", "0.1"], pl.Decimal(precision=2, scale=1))
print(s)

df = pl.DataFrame([s.sort()])

merge_sorted = df.lazy().merge_sorted(df.lazy(), 'a').collect().get_column('a')
append_sorted = s.append(s).sort()

assert_series_equal(merge_sorted, append_sorted)

Log output

thread '<unnamed>' panicked at crates/polars-ops/src/frame/join/merge_sorted.rs:44:49:
called `Result::unwrap()` on an `Err` value: ComputeError(ErrString("decimal precision 2 can't fit values with 3 digits"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/home/johndoe/Projects/polars/bug.py", line 9, in <module>
    merge_sorted = df.lazy().merge_sorted(df.lazy(), 'a').collect().get_column('a')
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johndoe/Projects/polars/py-polars/polars/lazyframe/frame.py", line 2056, in collect
    return wrap_df(ldf.collect(callback))
                   ^^^^^^^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: ComputeError(ErrString("decimal precision 2 can't fit values with 3 digits"))

Issue description

Expected behavior

Installed versions

Replace this line with the output of pl.show_versions(). Leave the backticks in place.
@coastalwhite coastalwhite added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
1 participant