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

Cannot create Array column containing large u64 value #16033

Closed
2 tasks done
stinodego opened this issue May 3, 2024 · 0 comments · Fixed by #16050
Closed
2 tasks done

Cannot create Array column containing large u64 value #16033

stinodego opened this issue May 3, 2024 · 0 comments · Fixed by #16050
Assignees
Labels
A-dtype-list/array Area: list/array data type accepted Ready for implementation bug Something isn't working P-low Priority: low python Related to Python Polars

Comments

@stinodego
Copy link
Member

stinodego commented May 3, 2024

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

u64_max = 2**64 - 1
s = pl.Series([[u64_max]], dtype=pl.Array(pl.UInt64, 1))
print(s)

Log output

Traceback (most recent call last):
  File "/home/stijn/code/polars/py-polars/repro.py", line 19, in <module>
    print(pl.Series([[u64_max]], dtype=pl.Array(pl.UInt64, 1)))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/series/series.py", line 312, in __init__
    self._s = sequence_to_pyseries(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/_utils/construction/series.py", line 138, in sequence_to_pyseries
    pyseries = _construct_series_with_fallbacks(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/_utils/construction/series.py", line 329, in _construct_series_with_fallbacks
    return constructor(name, values, strict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/series/series.py", line 312, in __init__
    self._s = sequence_to_pyseries(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/_utils/construction/series.py", line 313, in sequence_to_pyseries
    return _construct_series_with_fallbacks(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stijn/code/polars/py-polars/polars/_utils/construction/series.py", line 329, in _construct_series_with_fallbacks
    return constructor(name, values, strict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: Python int too large to convert to C long

Issue description

Issue in the constructor. This works fine for a List(UInt64) or a plain UInt64.

Expected behavior

Should work.

Installed versions

main

@stinodego stinodego added bug Something isn't working python Related to Python Polars P-low Priority: low A-dtype-list/array Area: list/array data type labels May 3, 2024
@stinodego stinodego self-assigned this May 4, 2024
@c-peters c-peters added the accepted Ready for implementation label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dtype-list/array Area: list/array data type accepted Ready for implementation bug Something isn't working P-low Priority: low python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants