Perspective int types overflow on Arrow unsigned int types
droher opened this issue · comments
David Roher commented
Bug Report
Steps to Reproduce:
Run this code in jupyterlab (duckdb version was 0.10.1 but should work on any recent version)
import perspective
import duckdb
import pyarrow as pa
import io
# Create a column of unsigned 8-bit integers (0-255)
table = duckdb.sql("""
SELECT 0::utinyint AS unsigned_col
UNION ALL
SELECT 127::utinyint
UNION ALL
SELECT 128::utinyint
UNION ALL
SELECT 255::utinyint
""").arrow()
buffer = io.BytesIO()
with pa.ipc.new_file(buffer, table.schema) as writer:
writer.write_table(table)
bytes_object = buffer.getvalue()
perspective_table = perspective.Table(bytes_object)
perspective.PerspectiveWidget(perspective_table)
Expected Result:
Should be able to handle without overflow
Actual Result:
Environment:
perspective-python 2.10.0
running on Python 3.11
, jupyterlab 3.6.5
, MacOS 14.4.1
.
Additional Context:
I first noticed this issue in the JS package but it was easier for me to create a replicable example in Python. This is a similar issue as the one I just posted in #2582, but seemed different enough to warrant a separate issue.