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

write_delta failed pyarrow.lib.ArrowInvalid: Integer value 133 not in range: 0 to 127 #20460

Closed
2 tasks done
MDGSF opened this issue Dec 26, 2024 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@MDGSF
Copy link

MDGSF commented Dec 26, 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 rerun as rr
from deltalake import write_deltalake
import polars as pl

recording = rr.dataframe.load_recording("test.rrd")
view = recording.view(index="log_time", contents="/**")
df = pl.from_arrow(view.select().read_all())

for col in df.columns:
    if df[col].dtype == pl.Datetime("ns"):
        df = df.with_columns(df[col].cast(pl.Datetime("us")))

df.write_delta("tmp/demo03")

Log output

Traceback (most recent call last):
  File "/home/huangjian/git/huangjian/bicv/rerun/demos/demo03_rrd_to_deltalake_polars/demo03.py", line 16, in <module>
    df.write_delta("tmp/demo03")
  File "/home/huangjian/anaconda3/envs/rerun/lib/python3.12/site-packages/polars/dataframe/frame.py", line 4498, in write_delta
    write_deltalake(
  File "/home/huangjian/anaconda3/envs/rerun/lib/python3.12/site-packages/deltalake/writer.py", line 317, in write_deltalake
    data, schema = _convert_data_and_schema(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/huangjian/anaconda3/envs/rerun/lib/python3.12/site-packages/deltalake/writer.py", line 670, in _convert_data_and_schema
    data = convert_pyarrow_table(data, conversion_mode)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/huangjian/anaconda3/envs/rerun/lib/python3.12/site-packages/deltalake/schema.py", line 187, in convert_pyarrow_table
    data = data.cast(schema).to_reader()
           ^^^^^^^^^^^^^^^^^
  File "pyarrow/table.pxi", line 4683, in pyarrow.lib.Table.cast
  File "pyarrow/table.pxi", line 593, in pyarrow.lib.ChunkedArray.cast
  File "/home/huangjian/anaconda3/envs/rerun/lib/python3.12/site-packages/pyarrow/compute.py", line 405, in cast
    return call_function("cast", [arr], options, memory_pool)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pyarrow/_compute.pyx", line 598, in pyarrow._compute.call_function
  File "pyarrow/_compute.pyx", line 393, in pyarrow._compute.Function.call
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Integer value 133 not in range: 0 to 127

Issue description

write_delta failed

Expected behavior

write delta sucess

Installed versions

--------Version info---------
Polars:              1.17.1
Index type:          UInt32
Platform:            Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python:              3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:31:09) [GCC 11.2.0]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
boto3                <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            0.22.3
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
google.auth          <not installed>
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         1.6.0
numpy                2.2.1
openpyxl             <not installed>
pandas               2.2.3
pyarrow              18.1.0
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>
None
@MDGSF MDGSF added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Dec 26, 2024
@MDGSF
Copy link
Author

MDGSF commented Dec 26, 2024

test.zip
this is test.rrd file

@MDGSF
Copy link
Author

MDGSF commented Dec 27, 2024

I think I know why, because Delta Lake does not support unsigned integers. Thanks so much.

@MDGSF MDGSF closed this as completed Dec 27, 2024
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
Development

No branches or pull requests

1 participant